From 323222d0f24e9ceddece0d6b17dae77148b886f7 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 13 Apr 2026 18:16:12 +0200 Subject: [PATCH] Fix scroll jump on chapter resume with continuous horizontal mode --- CHANGELOG.md | 1 + .../reader/viewer/hooks/useReaderPreserveScrollPosition.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98e39afd..c61b43b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - (**Reader**) Fix opening the previous/next chapter in the continuous horizontal mode with inverted reading direction - (**Reader**) Fix scroll preservation in continuous horizontal mode with righ to left reading direction - (**Reader**) Fix mobile progress bar previous/next button not being clickable in single page chapters +- (**Reader**) Fix scroll position jumping on chapter resume in the continuous horizontal mode - (**Manga**) Fix dynamic manga page color theme not getting reset after leaving the manga page ## [20251230.01] (r2937) - 2025-12-30 diff --git a/src/features/reader/viewer/hooks/useReaderPreserveScrollPosition.ts b/src/features/reader/viewer/hooks/useReaderPreserveScrollPosition.ts index 4b734621..907d5df8 100644 --- a/src/features/reader/viewer/hooks/useReaderPreserveScrollPosition.ts +++ b/src/features/reader/viewer/hooks/useReaderPreserveScrollPosition.ts @@ -282,10 +282,12 @@ const usePreserveOnInfiniteScrollPreviousChapterInitialRender = ( visibleChapters, ); + const doesPreviousChapterExist = currentChapterIndex > 0; const isRenderOfPreviousChapter = currentPageIndex === 0; // only relevant when prepending content to the dom due to the resulting layout shift - const isFirstRenderOfPreviousChapter = !previousNextChapterVisibility.previous && isRenderOfPreviousChapter; + const isFirstRenderOfPreviousChapter = + doesPreviousChapterExist && !previousNextChapterVisibility.previous && isRenderOfPreviousChapter; if (!isFirstRenderOfPreviousChapter) { return false; }