diff --git a/packages/web/lib/hooks/useScrollWatcher.tsx b/packages/web/lib/hooks/useScrollWatcher.tsx index 19580ed43..af47493f3 100644 --- a/packages/web/lib/hooks/useScrollWatcher.tsx +++ b/packages/web/lib/hooks/useScrollWatcher.tsx @@ -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]) }