From 12c08d44126e513e40cbd6cda86c920072811205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20de=20la=20Martini=C3=A8re?= Date: Wed, 26 Feb 2025 00:32:38 +0100 Subject: [PATCH] Fix scroll restoration (fix #831) --- src/hooks/useScrollRestoration.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useScrollRestoration.ts b/src/hooks/useScrollRestoration.ts index 76a8bed74..d9a59a40e 100644 --- a/src/hooks/useScrollRestoration.ts +++ b/src/hooks/useScrollRestoration.ts @@ -44,7 +44,7 @@ export function useScrollRestoration( }, [target, key]); useEffect(() => { - if (state === 'idle' && !init) { + if (state === 'idle' && !init && target != null) { setInit(true); target?.scrollTo(0, getScrollPosition(key)); }