Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: stabilize messages timeline virtualization #1664

Mergedjuliusmarmingemerged 11 commits intomain fromrefs/pull/1664/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Summary

  • Extracted timeline row derivation and row-height estimation into shared logic so the virtualizer uses the same row model as the renderer.
  • Improved changed-files height estimation by accounting for nested tree content, and surfaced virtual row metadata for debugging and verification.
  • Fixed ChangedFilesTree to respect the initial collapse state on first render and preserve expansion state across updates.
  • Added regression coverage for the collapsed directory rendering path and a browser harness that checks virtualization estimates against rendered heights.

Testing

  • Not run (PR description only).
  • Added ChangedFilesTree unit coverage for the initial collapse-state behavior.
  • Added Vitest browser coverage for timeline virtualization estimate mismatches and changed-files collapse/virtualizer synchronization.

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-virtual item keys to the current timeline width, and adds optional onVirtualizerSnapshot plus extra data-* attributes to aid debugging/verification.

Fixes ChangedFilesTree initial 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](https://cursor.com/dashboard?tab=bugbot) for commit 32ef60515c5dd7082289f1e8edbfe6d5fec35a7a. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).

Note

Stabilize messages timeline virtualization with improved row height estimation

  • Extracts timeline row derivation and height estimation into MessagesTimeline.logic.ts, grouping contiguous work log entries and handling proposed-plan, message, and working row kinds
  • Scopes virtualizer item keys by rounded timeline width to prevent stale measurement reuse on resize
  • Improves estimateMessagesTimelineRowHeight to account for changed-files cards, work group expansion/overflow, proposed-plan markdown length, and distinct assistant vs. user line heights
  • Reworks ChangedFilesTree expansion state to use a keyed { key, overrides } object instead of useEffect sync, so directories default to expanded/collapsed based solely on allDirectoriesExpanded
  • Adds an optional onVirtualizerSnapshot prop to MessagesTimeline for observing virtualizer measurements, plus a browser-based test suite validating height estimates against real renders
Macroscope summarized 32ef605.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: 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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: 1e853984-e485-4e6b-b4e4-04443468ee70

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `t3code/file-changed-virtualization-bug`

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    4. juliusmarminge merged this867cf4c

    5. juliusmarminge closed this

Sign in to join this conversation.