fix: stabilize messages timeline virtualization#1664
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
ApprovabilityVerdict: Approved This is a self-contained bug fix for timeline virtualization, extracting height estimation logic, improving accuracy of estimates, and adding proper cache invalidation on width changes. The changes include comprehensive browser tests and are limited to UI behavior without touching sensitive areas. You can customize Macroscope's approvability policy. Learn more. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
- Add varied changed-files virtualization scenarios - Expand tree tests for compacted prefixes and mixed roots
Dismissing prior approval to re-evaluate 77d811d
- Covers compacted directories and root files when expand-all is active
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate a370398
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate fe1ce1e
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 135bf5e
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 32ef605
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Summary
ChangedFilesTreeto respect the initial collapse state on first render and preserve expansion state across updates.Testing
ChangedFilesTreeunit coverage for the initial collapse-state behavior.Note
Medium Risk
Touches chat timeline virtualization and row-height estimation; mistakes could cause scroll-jank, incorrect cached heights, or missing content during expand/collapse, though changes are UI-only with no auth/data risk.
Overview
Stabilizes chat timeline virtualization by extracting a shared row model + height estimator (
deriveMessagesTimelineRows,estimateMessagesTimelineRowHeight) and using it for virtualizer sizing, including work-group expansion state and changed-files card height.Prevents stale virtualizer measurements on resize by scoping
react-virtualitem keys to the current timeline width, and adds optionalonVirtualizerSnapshotplus extradata-*attributes to aid debugging/verification.Fixes
ChangedFilesTreeinitial expand/collapse behavior by replacing effect-driven directory expansion state with an override map keyed by expand-mode + directory set, and adds unit + browser harness tests to catch estimate/measurement drift and ensure collapse/expand keeps the virtualizer in sync.Written by Cursor Bugbot for commit 32ef605. This will update automatically on new commits. Configure here.
Note
Stabilize messages timeline virtualization with improved row height estimation
estimateMessagesTimelineRowHeightto account for changed-files cards, work group expansion/overflow, proposed-plan markdown length, and distinct assistant vs. user line heightsChangedFilesTreeexpansion state to use a keyed{ key, overrides }object instead ofuseEffectsync, so directories default to expanded/collapsed based solely onallDirectoriesExpandedonVirtualizerSnapshotprop toMessagesTimelinefor observing virtualizer measurements, plus a browser-based test suite validating height estimates against real rendersMacroscope summarized 32ef605.