MCPcopy Create free account
hub / github.com/dailydotdev/apps / getScrollKey

Function getScrollKey

packages/shared/src/hooks/useScrollRestoration.ts:8–14  ·  view source on GitHub ↗
(asPath: string)

Source from the content-addressed store, hash-verified

6const RESTORE_TIMEOUT_MS = 1000;
7
8const 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
16export const useScrollRestoration = (): void => {
17 const { asPath } = useRouter();

Callers 2

handleScrollFunction · 0.85
useScrollRestorationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected