Repository navigation
fix(web): jump to the requested line when it arrives in a large file - #45441
juliusmarminge merged 4 commits into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Large-file previews now wait for the requested line to arrive before scrolling to it, while retaining end-of-file clamping after loading finishes. The change is limited to preview navigation and does not alter file contents or product defaults. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…eview-jump-past-first-chunk
Drop the scroll-restoration steps the change does not touch, and give resolveRevealLine one null path and a comment for the trailing-line-break rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EvidenceEnvironment: Chromium web client, 1280×800, light theme, fresh isolated state on each commit. On each commit, seed a fresh demo project with README.md containing Demo and a 9,600,000-byte big9.log (150,000 lines, NEEDLE_LINE_140000 on line 140,000), and a replay thread. Open the thread, use Ctrl+Shift+F to search Demo and open README.md to initialize the diff workers. Maximize the file panel, disable word wrap, and hide the file explorer for legible captures. Deliver the real big9.log HTTP response body at 500 KiB/s using a browser fetch stream wrapper, search NEEDLE_LINE_140000, and press Enter. Capture during download, await response EOF, then check the requested row is centered and has the file-link highlight; capture the final viewport. Repeat the identical scenario on base and head. Scenario: A search result beyond the preview is centered when its file arrivesProven: the scenario fails on base 54a42b22f4 and passes on head 68e1b44211.
Observed: base remains at rows 16,351–16,385 after EOF; head centers and highlights NEEDLE_LINE_140000 at line 140,000. Not shown:
|





Problem
Jumping to a line past the first 1 MB of a large text file (1–64 MB) via Project Content Search or a
file:linelink scrolls to the end of the 1 MB preview and stays there after the full file loads.FullTextPreviewrenders the partial preview whileuseFileLineRevealclamps the target and marks the request handled early.Change
apps/web/src/components/files/LargeFilePreview.tsx, passfile.doneto the reveal hook viaonPostRender?.(file.done), so scroll persistence and request cancellation stay active during download.apps/web/src/components/files/FilePreviewPanel.tsx, replaceclampFileLinewithresolveRevealLine(contents, line, complete)and passcompletethroughfileLineReveal("codeView", complete): targets past an incomplete preview resolve tonull(ignoring trailing\n/\r\n/\r), clear stale highlights, cancel superseded reveals, and defer without markinghandledRequestIduntil the target line arrives orcompleteistrue.apps/web/src/components/files/FilePreviewPanel.browser.test.tsxcovering download scroll persistence, in-preview reveal, request replacement, and deferred reveal.Scope
Small bug fix for wrong scroll target on 1–64 MB source previews (no issue). Covers web and Electron desktop; mobile has no large-file line reveal.
Verification
README.md(# Demo) and a 9.6 MBbig9.log(150,000 64-byte lines,NEEDLE_LINE_140000on line 140,000).README.md(Ctrl+Shift+F→Demo→Enter) to start the diff worker pool.big9.log:140000(NEEDLE_LINE_140000):d962b44fd353stays at lines 16,380–16,391;7db02642f46ccenters line 140,000.Setup. Ubuntu 26.04 (Linux x86_64), light theme, 1280x800, same
big9.logfixture with isolated state per commit (Browser panel; hostname "Test machine").d962b44fd353)7db02642f46c)Viewport stuck at lines 16380 to 16391 after full download of big9.log
Viewport centered and highlighted on line 140000 NEEDLE_LINE_140000 in big9.log
Not shown. Electron shell, macOS/Windows (shared web preview), mobile (no large-file line reveal), and repo-wide CI (
vp run check:changedandapps/web/src/components/filespassed).Automated test and check output (verified by AI agent)
d962b44fd353fail-first (5/5):6acf3525df51(test-only on7db02642f46c; byte-identical prod files): single test1 passed | 56 skipped (57)(235ms);apps/web/src/components/files41/41files,561/561tests (64.76s).vp run check:changed d962b44fd353: pass (format,lint,knip,typecheck,test163/163,react compiler).7db02642f46c, whereafter.pngwas captured; byte-identical prod files to6acf3525df51):event=050000→ lines 49,994–50,006;event=000050→ lines 44–56.git merge-tree --write-tree d962b44fd353 6acf3525df51: exit 0 (66094ccc4291d9756765d95691a7e630e59dc8e1).Generated with Gemini 4 Neon in T3 Code Nightly