fix(react): Add cancelAnimationFrame cleanup in useEffect

- Add cleanup function to cancel animation frame on unmount
- Prevents potential memory leaks and setState on unmounted component
- Closes #1093
This commit is contained in:
ClawdBot 2026-04-04 02:25:56 +03:00
parent c2bd2bc935
commit 805eacb9fc
3 changed files with 18 additions and 5 deletions

View file

@ -306,7 +306,8 @@ const TabsList = forwardRef<
}, [updateActiveIndicator]);
useEffect(() => {
requestAnimationFrame(updateActiveIndicator);
const frameId = requestAnimationFrame(updateActiveIndicator);
return () => cancelAnimationFrame(frameId);
}, [updateActiveIndicator]);
const scrollTabToCenter = useCallback((index: number) => {