Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

feat: 修复无限刷新问题 #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@ function fromResizeEvent(element: HTMLElement | Window): Observable<Event | Resi

return new Observable((subscriber) => {
const resizeObserver = new ResizeObserver((entries: ResizeObserverEntry[]) => {
subscriber.next(entries)

window.requestAnimationFrame(() => {
if (!Array.isArray(entries) || !entries.length) {
return;
}
subscriber.next(entries)
});

})
resizeObserver.observe(element as HTMLElement)

Expand Down