From 40cde320742c07d4b503384fb861229b1e1247ab Mon Sep 17 00:00:00 2001 From: selvaganapathycoder Date: Fri, 20 Feb 2026 18:50:38 +0530 Subject: [PATCH] fix(useScrolling): clear timeout on unmount to prevent memory leak The useEffect cleanup function in useScrolling was not clearing the scrollingTimeout, which could cause a memory leak and a setState call on an unmounted component. Added clearTimeout(scrollingTimeout) to the cleanup function. --- src/useScrolling.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/useScrolling.ts b/src/useScrolling.ts index 2e2ddbef9a..b832f403c8 100644 --- a/src/useScrolling.ts +++ b/src/useScrolling.ts @@ -20,6 +20,7 @@ const useScrolling = (ref: RefObject): boolean => { on(ref.current, 'scroll', handleScroll, false); return () => { + clearTimeout(scrollingTimeout); if (ref.current) { off(ref.current, 'scroll', handleScroll, false); }