From 5b1c11ff47d84ce67a8229fdb739475316e6f559 Mon Sep 17 00:00:00 2001 From: Stefan Hardegger Date: Mon, 23 Feb 2026 11:40:09 +0100 Subject: [PATCH] fix scrolling to position. --- frontend/src/app/stories/[id]/page.tsx | 6 ++++-- .../src/components/collections/CollectionReadingView.tsx | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/stories/[id]/page.tsx b/frontend/src/app/stories/[id]/page.tsx index b7c2146..996f31b 100644 --- a/frontend/src/app/stories/[id]/page.tsx +++ b/frontend/src/app/stories/[id]/page.tsx @@ -281,8 +281,10 @@ export default function StoryReadingPage() { // Wait for images to load before scrolling so scrollHeight is accurate const waitForImagesAndScroll = () => { if (!contentRef.current) { - // Content not in DOM yet, use a small delay - setTimeout(performScroll, 500); + // Content not in DOM yet (e.g. series API still loading) — retry + // until the ref is available rather than jumping straight to performScroll, + // which would silently no-op and never set hasScrolledToPosition. + if (!cancelled) setTimeout(waitForImagesAndScroll, 100); return; } diff --git a/frontend/src/components/collections/CollectionReadingView.tsx b/frontend/src/components/collections/CollectionReadingView.tsx index 24b524b..d63814c 100644 --- a/frontend/src/components/collections/CollectionReadingView.tsx +++ b/frontend/src/components/collections/CollectionReadingView.tsx @@ -134,7 +134,8 @@ export default function CollectionReadingView({ // Wait for images to load before scrolling so scrollHeight is accurate const waitForImagesAndScroll = () => { if (!contentRef.current) { - setTimeout(performScroll, 500); + // Content not in DOM yet — retry until the ref is available. + if (!cancelled) setTimeout(waitForImagesAndScroll, 100); return; }