mirror of
https://github.com/dergigi/boris.git
synced 2026-02-01 13:14:21 +01:00
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.
This commit is contained in:
@@ -265,6 +265,14 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
|
||||
|
||||
// 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' })
|
||||
|
||||
Reference in New Issue
Block a user