Skip to content

Commit

Permalink
fix: initialize throttleTimeout in cleanup function
Browse files Browse the repository at this point in the history
  • Loading branch information
kurateh committed Jun 13, 2024
1 parent a06422f commit c975d70
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/hooks/use-scroll-position/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const useScrollPosition = (props: UseScrollPositionOptions): ScrollValue
target.removeEventListener("scroll", handleScroll);
if (throttleTimeout.current) {
clearTimeout(throttleTimeout.current);
throttleTimeout.current = null;
}
};
}, [elementRef?.current, delay, handler, isEnabled]);
Expand Down

0 comments on commit c975d70

Please sign in to comment.