perf(ui): add virtual scrolling to file preview modal code viewer#101319
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 12:10 AM ET / 04:10 UTC. Summary PR surface: Source +88. Total +88 across 1 file. Reproducibility: yes. from source, though not from a live measured browser run: current main renders supported 256 KiB support files in one Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land the virtualized modal viewer after it resets the actual code-pane scroll position on file/query/files changes and the contributor adds redacted browser proof for large-file scrolling plus reset behavior. Do we have a high-confidence way to reproduce the issue? Yes from source, though not from a live measured browser run: current main renders supported 256 KiB support files in one Is this the best way to solve the issue? No as submitted. Virtualizing the modal is the right owner boundary, but this implementation needs to reset the actual scroll container and include real browser proof before it is the best fix. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1d128b4dd232. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +88. Total +88 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
13f14b4 to
d032a61
Compare
|
Merged using rebase. What changed after review:
Verification:
Landed on
Thanks @xianshishan! |
What Problem This Solves
The file preview modal in Skill Workshop renders entire file contents as a single giant
<pre>text node. For large support files (up to 256 KB / ~5000 lines), the browser struggles to layout and paint this monolithic DOM node, causing severe lag and freezing when scrolling through code.Fixes #99062
Why This Change Was Made
Replace the single
<pre>element with a virtual scrolling approach:<div class="code-line">elements<div>elements maintain correct scrollbar dimensions (totalLines * LINE_HEIGHT = 22px)requestAnimationFrameto avoid layout thrashingResizeObserveron the scroll container recalculates the visible range when the container resizesresetCodeScroll()clears the virtual range and resets.detail-body.scrollTopto 0 when switching files or filtering, preventing blank/stale contentconnectedCallback/disconnectedCallbackhandle lifecycle cleanup (rAF cancellation, ResizeObserver teardown)For a typical 256 KB file with ~5000 lines, DOM nodes drop from 1 giant text node to ~70 lightweight
<div>elements at any time.User Impact
Evidence
The file display area has been refactored into additional div elements; implementing virtual scrolling will help alleviate performance bottlenecks.
Changes
ui/src/components/file-preview-modal.ts(+98/-10): Replaced single<pre>with virtual-scrolled<div class="code-line">elementshandleCodeScrollwith rAF throttling for scroll-driven range recalculationrecalcVisibleRangefor computing visible line range from scroll position and container heightResizeObserverfor container resize-triggered range recalculationconnectedCallback/disconnectedCallbackfor lifecycle cleanupresetCodeScrollthat clears virtual indices and resetsscrollTopto 0 on file/query change.preCSS with.code-lineand.code-vscrollstylesApproach Validation
.prestyle (13px font * 1.7 = ~22px)