Skip to content

Commit

Permalink
fix(hook): re-attached scroll event behavior in useScrollPosition (#…
Browse files Browse the repository at this point in the history
…3247)

* fix: initialize throttleTimeout in cleanup function

* chore(changeset): add changeset

---------

Co-authored-by: WK Wong <wingkwong.code@gmail.com>
  • Loading branch information
kurateh and wingkwong authored Sep 12, 2024
1 parent 142f394 commit b0728e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-students-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/use-scroll-position": patch
---

re-attach scroll event behavior in `useScrollPosition`
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 @@ -77,6 +77,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 b0728e3

Please sign in to comment.