Skip to content

fix(reader): flush location on close#442

Open
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-reader-location-persistence
Open

fix(reader): flush location on close#442
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-reader-location-persistence

Conversation

@codedogQBY

Copy link
Copy Markdown
Owner

Analysis

  • [Bug] 不能记录上次阅读时的位置,而是会回到章节开始 #194 reports that reopening a book can return to the beginning of the chapter instead of the last read position.
  • Desktop ReaderView saved relocate progress through a 5s throttled updater. If the user closed the reader/app before the trailing throttled write fired, the latest CFI never reached the library store/database.
  • Mobile already has an immediate unmount save path; desktop did not.

Changes

  • Track the latest desktop relocate progress/CFI in a ref before the throttled save runs.
  • Flush that latest position on component unmount, pagehide, and beforeunload.
  • Keep the existing throttled save for normal reading so frequent relocate events do not spam writes.
  • Reset the latest-progress ref when switching books/tabs/formats.

Verification

  • pnpm --filter app exec tsc --noEmit
  • git diff --check

Fixes #194

@codedogQBY codedogQBY added bug Something isn't working priority:p1 High: important feature broken or major platform/workflow regression area:reader Reader, pagination, scrolling, layout, TOC labels Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:reader Reader, pagination, scrolling, layout, TOC bug Something isn't working priority:p1 High: important feature broken or major platform/workflow regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 不能记录上次阅读时的位置,而是会回到章节开始

1 participant