Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: toc active on page refresh

Francesco Sansalvadoreca014d9fb31c
diff --git a/apps/www/hooks/useActiveAnchors.tsx b/apps/www/hooks/useActiveAnchors.tsx
index d02509c147c..9ef2a5309e0 100644
--- a/apps/www/hooks/useActiveAnchors.tsx
+++ b/apps/www/hooks/useActiveAnchors.tsx
@@ -38,7 +38,7 @@ const useActiveAnchors = (
}
useEffect(() => {
- if (!isBrowser) return
+ if (!isBrowser || !router.isReady) return
anchors.current = document.querySelectorAll(anchorsQuerySelector)
toc.current = document.querySelectorAll(tocQuerySelector)
@@ -47,7 +47,7 @@ const useActiveAnchors = (
return () => {
window.removeEventListener('scroll', handleScroll)
}
- }, [])
+ }, [router])
return null
}