Skip to content

Commit

Permalink
fix(navbar): applying suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratyush committed Jun 25, 2024
1 parent ba3dfbf commit aa72c23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .changeset/happy-cameras-whisper.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@nextui-org/use-scroll-position": minor
"@nextui-org/use-scroll-position": patch
---

clearing throttleTimeout when it is supposed to be null in useScrollPosition
clearing throttleTimeout when it is supposed to be null in useScrollPosition (#3139)
7 changes: 3 additions & 4 deletions packages/hooks/use-scroll-position/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ export const useScrollPosition = (props: UseScrollPositionOptions): ScrollValue

const handleScroll = () => {
if (delay) {
if (throttleTimeout.current === null) {
throttleTimeout.current = setTimeout(handler, delay);
} else {
if (throttleTimeout.current) {
clearTimeout(throttleTimeout.current);
throttleTimeout.current = setTimeout(handler, delay);
}

throttleTimeout.current = setTimeout(handler, delay);
} else {
handler();
}
Expand Down

0 comments on commit aa72c23

Please sign in to comment.