mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
fix(hook): re-attached scroll event behavior in useScrollPosition (#3247)
* fix: initialize throttleTimeout in cleanup function * chore(changeset): add changeset --------- Co-authored-by: WK Wong <wingkwong.code@gmail.com>
This commit is contained in:
parent
142f394cb5
commit
b0728e3c38
5
.changeset/fast-students-promise.md
Normal file
5
.changeset/fast-students-promise.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@nextui-org/use-scroll-position": patch
|
||||
---
|
||||
|
||||
re-attach scroll event behavior in `useScrollPosition`
|
||||
@ -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]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user