fix(reader): Preload adjacent chapters when current chapter has a single page#642
Open
solstxce wants to merge 1 commit into
Open
Conversation
…gle page When a chapter consists of a single page, the reader never scrolls onto a ChapterTransition page, so the adjacent-chapter preload that the transition page normally triggers never runs. This left the reader unable to swipe backwards out of a 1-page chapter (issue null2264#617). Track a prevTransition on PagerViewerAdapter (mirroring nextTransition). Move the single-page adjacent preload out of the isIdle-only path into setChaptersDoubleShift so it runs in both code paths, and preload the previous chapter in addition to the next one either direction can swipe out of the chapter.
solstxce
force-pushed
the
fix/617-reader-stuck-single-page-prev-chapter
branch
from
July 16, 2026 05:10
50c9eb7 to
2bca021
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #617
Summary
When a chapter consists of exactly one page, the reader never scrolls onto a
ChapterTransitionpage, so the adjacent-chapter preload that the transition page normally triggers never runs. Because the lone page settles at idle with the same first/last index, swiping backwards out of the 1-page chapter cannot reach a loaded previous chapter, leaving the reader stuck (the forward direction was already handled, but only for the next chapter).Changes
PagerViewerAdapter.kt: Track aprevTransition(ChapterTransition.Prev) mirroring the existingnextTransition, so the previous-adjacent chapter is reachable for inspection.PagerViewer.kt: Move the single-page adjacent-chapter preload out of theisIdle-only path intosetChaptersDoubleShiftso it runs regardless of which code path sets the chapters, and preload the previous chapter in addition to the next one.This lets the user swipe out of a 1-page chapter in either direction, since the preceding chapter is preloaded and the "Load Previous Chapter" transition can proceed.
Notes
1040eccd7e "Fix chapter transition setting for one page chapters"only preloadednextTransition?.to, and only when chapters arrived while the pager was non-idle. This regressed for the backward direction and for the idle path.requestPreloadChapter->ReaderViewModel.preload->Event.ReloadViewerChapters), so once the previous chapter loads the viewer is updated as usual.Testing
Manual repro from the issue: open a manga, ensure the previous chapter has exactly 1 page, read the current chapter, swipe back into the 1-page chapter, then swipe back again. The reader should now trigger the "Load Previous Chapter" transition instead of getting stuck. Build/CI verification via
./gradlew assembleStandardRelease+ unit tests.