(asPath: string)
| 6 | const RESTORE_TIMEOUT_MS = 1000; |
| 7 | |
| 8 | const getScrollKey = (asPath: string): string => { |
| 9 | if (typeof window === 'undefined') { |
| 10 | return asPath; |
| 11 | } |
| 12 | const historyKey = (window.history.state as { key?: string } | null)?.key; |
| 13 | return historyKey ? `${asPath}:${historyKey}` : asPath; |
| 14 | }; |
| 15 | |
| 16 | export const useScrollRestoration = (): void => { |
| 17 | const { asPath } = useRouter(); |
no outgoing calls
no test coverage detected