✨ Replace history for image-based reading - #1402
Merged
Merged
Conversation
Merged
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 #1378
Description
Summary of changes
Fixed the issue where navigating to a different page inside the reader (image / PDF / CBZ/CBR) — e.g. via the "Go to page" input or switching reading mode — pushed a new history entry instead of replacing the current one. As a result, the browser Back button stepped through every visited page one-by-one rather than exiting the reader.
The fix makes these internal reader navigations replace the current history entry instead of adding to it:
packages/browser/src/scenes/book/reader/BookReaderScene.tsx— the auto-navigation to the reader route (EPUB → reader, PDF → reader, and page-clamp redirects) now uses{ replace: true }packages/browser/src/components/readers/imageBased/ImageBasedReader.tsx— "Go to page" navigation now replaces the current entrypackages/browser/src/components/readers/imageBased/container/ReaderSettings.tsx— changing the reading mode (which rewrites the?page=search param) now replaces the current entrypackages/browser/src/components/readers/imageBased/continuous/ContinuousScrollReader.tsx— clearing the?page=param when switching to continuous scroll now replaces the current entryReasoning
Switching pages is a transient in-reader action, not a meaningful "back" destination. By replacing the history entry, the Back button takes you back to where you were before opening the reader, which is the expected behavior.
Additional context
Affects the web reader only (
packages/browser). No state/logic changes — purely the navigation mode of existingnavigate()/setSearch()calls.Screenshots
(Non-visual behavioral change — no screenshots. You can verify by opening a multi-page PDF/CBZ, jumping between pages, then pressing the browser Back button; it should leave the reader in one press instead of stepping back through each page.)
Ready?
Please read each item and check the boxes:
nightlyand notmainWhich matches how it was actually done? I can finalize the full PR body with the matching wording.
Stump Contributor License Agreement
By contributing to Stump, you agree that your contributions will be licensed under the following licenses (where applicable):