Repository navigation
feat(fork): files reopen where the reader stopped - #163
Open
orbitingflea wants to merge 1 commit into
Open
orbitingflea wants to merge 1 commit into
orbitingflea wants to merge 1 commit into
Conversation
A file tab scrolled halfway opened at the top again after a switch to another tab, a reopen or a reload, because each viewer remounts with a fresh scroll container. The source and rendered Markdown viewers now save the reader's place in localStorage (one key per file and view, 30-day expiry, 300-entry cap) and restore it on mount. PDF.js seeds its view from the same store. Only scrolls after reader input are saved. A line reveal still wins until it has landed once; a new request always reveals, even when the panel store restarts its id at 1 after a tab was closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
This pull request makes a file in the right panel open where the reader stopped.
改了什么行为
Behaviour change: yes, a web or desktop user who scrolls a code file, a rendered Markdown file or a PDF.js document in the right panel finds it at the same place after switching tabs, closing and reopening it, or reloading or restarting the app (same browser profile, for 30 days); a citation that names a line still jumps to that line.
Why
Two file tabs of one workspace share one file panel, and each viewer is keyed by path. So a tab switch mounted a fresh scroll container at the top, and nothing saved where the reader was.
Checks
How to undo
Revert the commit. The saved positions stay in the browser under the
t3code.fileReading.v1:andt3code.fileReveal.v1:keys and are ignored.Design notes
fileReadingStore.tsis the storage, with no DOM: one localStorage key per file and view, decoded entry by entry, 30-day expiry, at most 300 positions and 200 reveal receipts. An in-memory age index evicts on insert. A full quota drops expired entries and the oldest half once, then keeps positions in memory for the page.getNumericScrollAnchor) for code, and a top-level block plus a fraction for Markdown. PDF.js reuses its own view state.openFile. So a reveal is shown once its object has landed. The reveal hook gets a number per object instead of the store's request id, which restarts at 1 after a close. Receipts carry the shown state across reloads. A read-only store subscription forgets the receipts of closed tabs. The change makes no write to the right panel store. AsettleFileRevealstore action, like the one for pull requests, would let most of this go later.fileReadingSave.tsholds the PDF part, so the chat view's PDF frame does not load Pierre's file classes.FilePreviewPanel.tsx+34 −9 andBrowserDocumentFrame.tsx+11 −2. The README's fork list gains one line.