mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Cancel scroll watcher timeout
This commit is contained in:
parent
f811339398
commit
c19460eb75
1 changed files with 6 additions and 1 deletions
|
|
@ -37,6 +37,11 @@ export function useScrollWatcher(effect: Effect, delay: number): void {
|
|||
}
|
||||
|
||||
window.addEventListener('scroll', handleScroll)
|
||||
return () => window.removeEventListener('scroll', handleScroll)
|
||||
return () => {
|
||||
if (throttleTimeout.current) {
|
||||
clearTimeout(throttleTimeout.current)
|
||||
}
|
||||
window.removeEventListener('scroll', handleScroll)
|
||||
}
|
||||
}, [currentOffset, delay, effect])
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue