File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,15 @@ import { ContextQuote } from '@/context/ContextQuote'
1111import { ContextTopTenPosts } from '@/context/ContextTopTenPosts'
1212import { ContextTopUsers } from '@/context/ContextTopUsers'
1313import { useFocusTrap } from '@/hooks/useFocusTrap'
14+ import { useScrollRestoration } from '@/hooks/useScrollRestoration'
1415
1516export default function Home ( ) {
1617 const quoteRef = useRef < HTMLQuoteElement > ( null )
1718 const topTenPostsRef = useRef < HTMLDivElement | null > ( null )
1819 const topUsersRef = useRef < HTMLDivElement | null > ( null )
1920
2021 useFocusTrap ( )
22+ useScrollRestoration ( )
2123
2224 return (
2325 < div className = "min-h-svh flex flex-col items-center justify-start bg-gradient-to-b from-stone-700 to-stone-800" >
Original file line number Diff line number Diff line change 1+ 'use client'
2+
3+ import { useEffect } from 'react'
4+
5+ export const useScrollRestoration = ( ) => {
6+ useEffect ( ( ) => {
7+ if ( 'scrollRestoration' in window . history ) {
8+ window . history . scrollRestoration = 'manual'
9+ }
10+ } , [ ] )
11+ }
You can’t perform that action at this time.
0 commit comments