From 833ea18800d6a5e8790b113d3b56c0b62bb8f38c Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Wed, 8 Apr 2026 01:39:14 -0700 Subject: [PATCH] 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 --- surfsense_web/components/ui/animated-tabs.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/surfsense_web/components/ui/animated-tabs.tsx b/surfsense_web/components/ui/animated-tabs.tsx index 58c988a7c..7bc12821f 100644 --- a/surfsense_web/components/ui/animated-tabs.tsx +++ b/surfsense_web/components/ui/animated-tabs.tsx @@ -310,7 +310,8 @@ const TabsList = forwardRef< }, [updateActiveIndicator]); useEffect(() => { - requestAnimationFrame(updateActiveIndicator); + const id = requestAnimationFrame(updateActiveIndicator); + return () => cancelAnimationFrame(id); }, [updateActiveIndicator]); const scrollTabToCenter = useCallback((index: number) => {