Skip to content

Commit

Permalink
chore: remove unnecessary type and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
maksimr committed Nov 15, 2022
1 parent e51ef24 commit 3ebdbf5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/react/useResizeObserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export function useResizeObserver(fn, options) {
return;
}
cleanup();
/** @type {Element|null} */
ref.current.element = element;
ref.current.options = options;
if (!element) return;
const resizeObserver = new ResizeObserver((entries) => {
ref.current.timerId && cancelAnimationFrame(ref.current.timerId);
// Use requestAnimationFrame to prevent "ResizeObserver loop limit exceeded" error
ref.current.timerId = requestAnimationFrame(() => {
if (ref.current.callback) {
const entry = entries[0];
Expand Down

0 comments on commit 3ebdbf5

Please sign in to comment.