function useScrollRestore
useScrollRestore(
scrollY: number | null | undefined,
loaded: boolean
): void

Scrolls the window to scrollY once loaded, and never again, before paint so that the restored page doesn't flash at the top. Feed pages pass useFeedCache's cached?.scrollY, which is undefined when nothing was restored.

Parameters

scrollY: number | null | undefined
loaded: boolean

Return Type

void

Usage

import { useScrollRestore } from "src/hooks/feed/useScrollSave.ts";