From eb5799336c22e884e7eecde4273b5051d76fa83e Mon Sep 17 00:00:00 2001 From: "DESKTOP-RTLN3BA\\$punk" Date: Mon, 6 Apr 2026 22:15:05 -0700 Subject: [PATCH] refactor: streamline BrowserWindow component functionality - Removed the interval management for tab selection, simplifying the state handling. - Updated tab click handler to directly set the selected index without restarting the interval. - Changed video preload attribute from "none" to "auto" for improved loading performance. --- .../components/homepage/hero-section.tsx | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/surfsense_web/components/homepage/hero-section.tsx b/surfsense_web/components/homepage/hero-section.tsx index 1bb28e770..60f293005 100644 --- a/surfsense_web/components/homepage/hero-section.tsx +++ b/surfsense_web/components/homepage/hero-section.tsx @@ -180,32 +180,8 @@ function GetStartedButton() { const BrowserWindow = () => { const [selectedIndex, setSelectedIndex] = useState(0); const selectedItem = TAB_ITEMS[selectedIndex]; - const intervalRef = useRef(null); const { expanded, open, close } = useExpandedMedia(); - const startInterval = useCallback(() => { - if (intervalRef.current) { - clearInterval(intervalRef.current); - } - intervalRef.current = setInterval(() => { - setSelectedIndex((prev) => (prev + 1) % TAB_ITEMS.length); - }, 10000); - }, []); - - useEffect(() => { - startInterval(); - return () => { - if (intervalRef.current) { - clearInterval(intervalRef.current); - } - }; - }, [startInterval]); - - const handleTabClick = (index: number) => { - setSelectedIndex(index); - startInterval(); - }; - return ( <> @@ -220,7 +196,7 @@ const BrowserWindow = () => {