Repository navigation
Keep recently left documents as they were; quiet data tables and scanned PDFs - #796
Merged
Merged
Conversation
…stant Switching to another file in the panel and back reopened a document from scratch: a PDF was downloaded, parsed and painted again, and a Word or PowerPoint file fetched, prepared, opened in a new engine and laid out again. A 69-page PDF took about 1.8 s to show again, a Word report about 0.9 s. A small cache (scient/documentCache) now keeps the opened document of the last two files a reader left: the pdf.js document, or the prepared Office file with its engine session. The drawn pages are not kept. A document has one reader at a time, a second reader opens its own copy, and a file whose revision changed opens afresh; edited PDF copies and files of unknown revision are never kept. Kept documents stay within 64 MB per GB of the computer's memory (128 to 512 MB), each kind estimating what it holds from measurements in the desktop app: a Word engine about 120 MB and 1.5 MB per laid-out page, PowerPoint 100 MB and 32 times the file, a PDF 40 MB and 12 times the file. Measured in the dev app (macOS, Apple silicon): switching back to the PDF 1.8 s -> 0.4 s, to the Word report 0.9 s -> 0.4 s; memory stays level while cycling through twelve files. A kept PDF shows at once where it was left, its pages painting in place, rather than waiting for every visible page as a first open does. Word and PowerPoint open their engine in a session (T3's effect bodies, moved), which the viewer subscribes to. The revision boundary now opens the preview once the file's revision is known, and names it for the cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The table read its rows again after every command, edit, tool call or subagent anywhere in the thread: its revision was the workspace mutation id, so the cells blanked and refilled while an agent worked. It now checks the file's revision on each possible change and reads the rows again only for a new one, or when the reader asks to reload. An environment that reports no revision reads them on every change, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pages take their size from a width a resize observer reports after layout. On a loaded CI runner the jump ran while every page was still zero high, so it stayed at the top. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…shows them as left Switching to another file and back reopened a PDF or Office file's view: the document was kept, but its pages were laid out and drawn again. The file panel's body is now ScientDocumentShelf, which keeps the last left PDF, Word and PowerPoint views mounted but hidden while their reader keeps them. Coming back shows the same view at the same place, nothing drawn again. - documentCache: a reader hidden but kept parks its lease. Kept views and kept documents share the count (2) and the memory budget, which counts a hidden view's canvases; past them the view left longest ago is asked to go. - A hidden PDF pauses pdf.js's rendering queue and drops pages out of view; a hidden Office view draws only the pages in view. - A reload counts for the file shown when it was asked, so it does not remount another file's hidden view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A PDF whose opening pages had no text showed a standing warning bar over the page, read or not. The bar is gone; when Enter in the search field finds nothing in such a PDF, a small card under the field says its pages are images, until the query changes or focus leaves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
A PDF reader reopens its document once its signed URL is renewed, right after first opening it. For that moment the document counted as left, one more than the limit, so the hidden view left longest ago was dropped: with three PDFs visited, only one stayed hidden instead of two. A hidden view holds its document too, so past the limits documents kept without a reader now go first, then the hidden view left longest ago. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What Changed
Documents you leave and come back to stay as you left them, and two reading annoyances are gone.
scient/documentCache): the opened document of the last two PDF, Word or PowerPoint files you left (pdf.js document; prepared Office file with its engine session) is kept, within 64 MB per GB of the computer's memory (128–512 MB). Coming back no longer downloads, parses or lays out the file again. A changed file opens afresh.scient/documentShelf): in the file panel the last left views also stay mounted but hidden, so coming back shows the same view at the same scroll with nothing drawn again. Hidden views and kept documents share one count and one budget, which counts a hidden view's canvases. A hidden PDF pauses pdf.js's rendering queue and drops pages out of view, and a hidden Office view draws only the pages in view. A PDF left while still opening is not kept. Past the limits, documents kept without a view go before hidden views, so a PDF reader reopening its document when its URL is renewed no longer pushes out a hidden view.Why
The owner found that switching to another file and back reloaded PDFs and Office documents, a data table blanked after each agent command, and a scanned PDF carried a permanent banner while being read.
Measured in the dev app on macOS (Apple silicon):
Chat typing with hidden PDFs, measured with the #801 typing harness (production build, headless Chromium, 4× CPU throttle, 149 keys, synthetic 320-page PDFs):
Codex reviewed the design (3 findings) and the code (1 finding); all fixed, each with a test or a live check.
Documentation Impact
Documentation impact: Updated —
docs/user/file-previews.md,UPSTREAM.md(Kept documents).Platforms
Tested on macOS only. Windows and Linux are not run. Nothing here is platform specific: one budget follows
navigator.deviceMemory.Checklist
🤖 Generated with Claude Code