diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx
index 65c984f6997..87a18b11847 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx
@@ -123,7 +123,7 @@ const NavigationMenuRefList = ({ currentLevel, setLevel, id }) => {
- {console.log({ clientLibsCommon })}
+ {/* {console.log({ clientLibsCommon })} */}
{clientLibsCommon.functions
.filter((x) => x.product === 'database')
.map((x, index) => {
diff --git a/apps/docs/layouts/ref/RefSubLayout.tsx b/apps/docs/layouts/ref/RefSubLayout.tsx
index ca15f3c4389..f280172be7b 100644
--- a/apps/docs/layouts/ref/RefSubLayout.tsx
+++ b/apps/docs/layouts/ref/RefSubLayout.tsx
@@ -1,6 +1,5 @@
import { useInView } from 'react-intersection-observer'
-import { FC, useEffect, useState } from 'react'
-import { useRouter } from 'next/router'
+import { FC } from 'react'
interface ISectionContainer extends FC {
id: string
@@ -34,7 +33,7 @@ const RefSubLayout: FC & RefSubLayoutSubComponents = (props) =
const Section: FC = ({ id, title, monoFont, children }) => {
return (
-
+
{children}
@@ -42,25 +41,21 @@ const Section: FC = ({ id, title, monoFont, children }) => {
}
const StickyHeader: FC = ({ id, title, monoFont }) => {
- const router = useRouter()
-
const { ref } = useInView({
threshold: 1,
- rootMargin: '-20% 0% -35% 0px',
+ rootMargin: '30% 0% -35% 0px',
onChange: (inView, entry) => {
- //if (inView) router.push(entry.target.id, undefined, { shallow: true })
+ if (inView && window) window.history.pushState(null, '', entry.target.id)
},
})
return (
- {title}
+ {title}
)
}
diff --git a/apps/docs/pages/new/reference/javascript/[...slug].tsx b/apps/docs/pages/new/reference/javascript/[...slug].tsx
index 8cc6efafc85..5f1a06e90a6 100644
--- a/apps/docs/pages/new/reference/javascript/[...slug].tsx
+++ b/apps/docs/pages/new/reference/javascript/[...slug].tsx
@@ -31,6 +31,8 @@ export default function JSReference(props) {
const router = useRouter()
const slug = router.query.slug[0]
+ // When user lands on a url like http://supabase.com/docs/new/reference/javascript/sign-up
+ // find the #sign-up element and scroll to that
useEffect(() => {
if (document && slug !== 'start') {
document.querySelector(`#${slug}`).scrollIntoView()