From 5a6ac628d2cb08ea1ec318e8734a4d09fc64fc2b Mon Sep 17 00:00:00 2001 From: Gigi Date: Fri, 31 Oct 2025 01:37:02 +0100 Subject: [PATCH] fix: add save suppression when resetting scroll position Add 500ms save suppression when article changes to prevent accidentally saving 0% reading position during navigation. This works together with existing safeguards (tracking disabled, document height check, throttling) to ensure reading progress is only saved during actual reading. --- src/components/ContentPanel.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/ContentPanel.tsx b/src/components/ContentPanel.tsx index dd42cdac..48f427be 100644 --- a/src/components/ContentPanel.tsx +++ b/src/components/ContentPanel.tsx @@ -265,6 +265,14 @@ const ContentPanel: React.FC = ({ // Reset scroll position and restore ref when article changes useEffect(() => { + if (!articleIdentifier) return + + // Suppress saves during navigation to prevent saving 0% position + // The 500ms suppression covers the scroll reset and initial render + if (suppressSavesForRef.current) { + suppressSavesForRef.current(500) + } + // Reset scroll to top when article identifier changes // This prevents showing wrong scroll position from previous article window.scrollTo({ top: 0, behavior: 'instant' })