mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 09:16:22 +02:00
fix: add cancelAnimationFrame cleanup in animated-tabs useEffect
Store the requestAnimationFrame ID and cancel it on unmount to prevent updateActiveIndicator from running on an unmounted component. Fixes #1093
This commit is contained in:
parent
553843ab06
commit
833ea18800
1 changed files with 2 additions and 1 deletions
|
|
@ -310,7 +310,8 @@ const TabsList = forwardRef<
|
|||
}, [updateActiveIndicator]);
|
||||
|
||||
useEffect(() => {
|
||||
requestAnimationFrame(updateActiveIndicator);
|
||||
const id = requestAnimationFrame(updateActiveIndicator);
|
||||
return () => cancelAnimationFrame(id);
|
||||
}, [updateActiveIndicator]);
|
||||
|
||||
const scrollTabToCenter = useCallback((index: number) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue