fix(emcn): stop wiping virtualized code viewer row measurements on content changes#5649
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview The re-measure Reviewed by Cursor Bugbot for commit d947cb9. Configure here. |
Greptile SummaryThis PR changes when the virtualized code viewer resets row measurements.
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(emcn): stop wiping virtualized code ..." | Re-trigger Greptile |
Summary
Code.Viewer(workflow editor terminal Output/Input panel) — reported in Slack with a wrappedconversationIdline drawing over the row below itvirtualizer.measure()on everyvisibleLinesidentity change. TanStack Virtual'smeasure()wipes the size cache without re-measuring mounted rows — ResizeObserver only fires on size changes and React never re-invokes an unchangedmeasureElementref — so any content change that keeps row heights (Prism finishing its lazy load right after first open, search-highlight<mark>wrapping) permanently collapsed every wrapped row to the 21px estimateType of Change
Testing
Reproduced deterministically in an isolated Playwright harness rendering
Code.Viewerwithvirtualized+wrapText: before the fix, a height-preserving content change left rows attranslateY(0/21/42…)while wrapped rows measured taller (overlap); after, every row's offset equals the cumulative measured heights. Ran a 12-scenario matrix (prism lazy-load, search set/clear, JSON collapse toggle on/off, content change both directions, width narrow/restore, wrap off/on, search after wrap cycle): original code fails 8/12 with overlap, fixed code passes 12/12 including every scenario the original passed. Typecheck (emcn + sim) and biome clean.Checklist