perf(ui): add virtual scrolling to file preview modal code viewer#99063
perf(ui): add virtual scrolling to file preview modal code viewer#99063xianshishan wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 2, 2026, 9:30 PM ET / 01:30 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 large support-file contents as one full 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:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land the virtualized modal code viewer after the branch 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 large support-file contents as one full Is this the best way to solve the issue? No for this branch as submitted. Virtualizing the modal is the right owner boundary, but the implementation must 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 4440226d52c2. Label changesLabel 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
|
db3d498 to
bcd3d92
Compare
bcd3d92 to
78b39e3
Compare
Replace single <pre> element with virtual scrolling to improve rendering performance for large files. Also fixes lint issues with no-underscore-dangle and curly rules.
78b39e3 to
f937ad6
Compare
|
Closing due to merge conflicts with main. Will re-open a clean PR after rebasing. |
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
Before
After
Changes
ui/src/ui/components/file-preview-modal.ts:<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-vscrollstyles