fix(web): reduce chat timeline scroll twitching and overlap#1054
fix(web): reduce chat timeline scroll twitching and overlap#1054huxcrux wants to merge 6 commits intopingdotgg:mainfrom
Conversation
|
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)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
i think the actual fix is to do better, more accurate, estimations and having regression tests (ChatView.browser.tsx) to verify estimate === actual ? I've fixed it couple times but when new UI changes are made and we don't update the estimates it regresses. Need tests to ensure it stays in sync.
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
Note
Improve timeline scroll stability with accurate row height estimation
MIN_ROWS_TO_ENABLE_VIRTUALIZATION) to avoid measurement overhead when it isn't needed.estimateTimelineWorkGroupHeightin timelineHeight.ts to size work-group rows based on visible entries, chip wrapping, and expansion state.estimateChangedFilesSummaryHeightandestimateTimelineRowHeightin MessagesTimeline.tsx to account for completion dividers and changed-files summaries in assistant message rows.countVisibleTurnDiffTreeNodesin turnDiffTree.ts to compute visible diff-tree node counts based on directory expansion state.shouldAdjustScrollPositionOnItemSizeChangenow triggers when remaining scroll distance is ≤AUTO_SCROLL_BOTTOM_THRESHOLD_PX(previously only when greater), fixing auto-scroll near the bottom.Macroscope summarized 0b7ecce.