Skip to content

fix(web): reduce chat timeline scroll twitching and overlap#1054

Open
huxcrux wants to merge 5 commits intopingdotgg:mainfrom
huxcrux:feature/timeline-scroll-stability
Open

fix(web): reduce chat timeline scroll twitching and overlap#1054
huxcrux wants to merge 5 commits intopingdotgg:mainfrom
huxcrux:feature/timeline-scroll-stability

Conversation

@huxcrux
Copy link
Contributor

@huxcrux huxcrux commented Mar 13, 2026

What Changed

This PR reduces chat timeline scroll twitching and overlap.

Smaller and medium-sized threads now render without virtualization, which removes the late row mounting and remeasurement that were causing visible jumps while scrolling upward. Larger threads still use the standard virtualized path.

The remaining row height estimation is kept only for the cases that still need it:

grouped work/tool rows
assistant messages with changed-files summaries

Fixes #1035
Related to #988, #905, #860

Why

Older rows were being mounted and resized after entering view, which caused the timeline to twitch while scrolling and sometimes contributed to overlap.

Disabling virtualization for the thread sizes users hit most often is the simplest and most reliable fix. It removes the unstable behavior directly while still keeping virtualization for larger threads.

UI Changes

This PR improves chat scroll stability and removes visible upward-scroll twitching in affected threads.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Improve timeline scroll stability with accurate row height estimation

  • Disables virtualization for short timelines (below MIN_ROWS_TO_ENABLE_VIRTUALIZATION) to avoid measurement overhead when it isn't needed.
  • Adds estimateTimelineWorkGroupHeight in timelineHeight.ts to size work-group rows based on visible entries, chip wrapping, and expansion state.
  • Adds estimateChangedFilesSummaryHeight and estimateTimelineRowHeight in MessagesTimeline.tsx to account for completion dividers and changed-files summaries in assistant message rows.
  • Adds countVisibleTurnDiffTreeNodes in turnDiffTree.ts to compute visible diff-tree node counts based on directory expansion state.
  • Behavioral Change: shouldAdjustScrollPositionOnItemSizeChange now triggers when remaining scroll distance is ≤ AUTO_SCROLL_BOTTOM_THRESHOLD_PX (previously only when greater), fixing auto-scroll near the bottom.

Macroscope summarized 38d0d3a.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

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: 2341d16d-b9d8-40fd-8e81-137584fff0b6

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
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 13, 2026
@huxcrux huxcrux changed the title Feature/timeline scroll stability fix(web): reduce chat timeline scroll twitching and overlap Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat timeline content overlaps (assistant text + tool call cards stack on top of each other)

1 participant