mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 11:50:42 +08:00
Apply restored scroll position only once
This commit is contained in:
@@ -31,6 +31,9 @@
|
||||
// Restore a previously-captured scroll position (used on history nav).
|
||||
initialCache?: ListCacheSnapshot;
|
||||
initialScrollOffset?: number;
|
||||
// Called once the restore has been applied, so the provider can stop
|
||||
// handing out the (now stale) values to later remounts of this list.
|
||||
onRestored?: () => void;
|
||||
// Reports the current scroll position so callers can persist it.
|
||||
onState?: (state: {
|
||||
scrollOffset: number;
|
||||
@@ -59,6 +62,7 @@
|
||||
prefetchPx = 800,
|
||||
initialCache = undefined,
|
||||
initialScrollOffset = undefined,
|
||||
onRestored = undefined,
|
||||
onState = undefined,
|
||||
onScrollState = undefined,
|
||||
}: Props = $props();
|
||||
@@ -134,6 +138,7 @@
|
||||
if (initialScrollOffset) {
|
||||
handle.scrollTo(initialScrollOffset);
|
||||
}
|
||||
onRestored?.();
|
||||
});
|
||||
|
||||
function reportState() {
|
||||
|
||||
Reference in New Issue
Block a user