From 260641e68cd3e06c9d8f1f11eec5fdb543cfe3de Mon Sep 17 00:00:00 2001 From: Eric Gullickson <16152721+ericgullickson@users.noreply.github.com> Date: Sun, 15 Feb 2026 19:32:46 -0600 Subject: [PATCH] fix: links from homepage to guide not working --- frontend/src/pages/GuidePage/GuidePage.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frontend/src/pages/GuidePage/GuidePage.tsx b/frontend/src/pages/GuidePage/GuidePage.tsx index 2ddb6fa..f8cae6d 100644 --- a/frontend/src/pages/GuidePage/GuidePage.tsx +++ b/frontend/src/pages/GuidePage/GuidePage.tsx @@ -35,6 +35,25 @@ export const GuidePage = () => { navigate('/signup'); }, [navigate]); + // Scroll to hash target after lazy-loaded sections render + useEffect(() => { + const hash = window.location.hash.slice(1); + if (!hash) return; + + // Poll for the element since Suspense sections load asynchronously + let attempts = 0; + const interval = setInterval(() => { + const target = document.getElementById(hash); + if (target) { + clearInterval(interval); + target.scrollIntoView({ behavior: 'smooth' }); + } + if (++attempts >= 20) clearInterval(interval); + }, 100); + + return () => clearInterval(interval); + }, []); + // Track scroll position for nav background and active section useEffect(() => { const handleScroll = () => {