Skip to content

✨ Replace history for image-based reading - #1402

Merged
aaronleopold merged 1 commit into
stumpapp:mainfrom
qinghon:fix-replace-history-view
Sep 10, 2026
Merged

aaronleopold merged 1 commit into
stumpapp:mainfrom
qinghon:fix-replace-history-view

Conversation

@qinghon

@qinghon qinghon commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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 entry
  • packages/browser/src/components/readers/imageBased/container/ReaderSettings.tsx — changing the reading mode (which rewrites the ?page= search param) now replaces the current entry
  • packages/browser/src/components/readers/imageBased/continuous/ContinuousScrollReader.tsx — clearing the ?page= param when switching to continuous scroll now replaces the current entry

Reasoning

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 existing navigate() / 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:

  • I read the contributing guidelines
  • I searched for existing issues or pull requests that may be related to my contribution
  • This PR is based into nightly and not main
  • I added tests and/or documentation for my changes if applicable
  • I disclosed any use of LLMs in the creation of this PR (if applicable) — Yes. An LLM (assistant) was used to assist in making the code changes in this PR; I reviewed each change before committing.

Which 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):

@aaronleopold aaronleopold changed the title support replace history when view ✨ Replace history for image-based reading Sep 10, 2026

@aaronleopold aaronleopold left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@aaronleopold
aaronleopold merged commit 3672c8f into stumpapp:main Sep 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Replace browser history entry instead of pushing a new one

2 participants