Fix thread timeline autoscroll and simplify branch state#2002
Conversation
- Remove the message-only empty-state gate from ChatView - Auto-snap MessagesTimeline to the bottom when non-message rows first appear - Add browser coverage for empty-to-populated and activity-row rendering
|
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 |
ApprovabilityVerdict: Approved Straightforward bug fix that adds autoscroll behavior when timeline entries first appear after an empty state, with a minor simplification removing a redundant prop in favor of an internal length check. Changes are well-scoped, include proper cleanup, and are covered by new tests. You can customize Macroscope's approvability policy. Learn more. |
Summary
Testing
bun fmt,bun lint, andbun typecheckshould pass before merge.Note
Medium Risk
Adjusts chat timeline empty-state and autoscroll behavior; small but user-visible changes to scrolling could introduce regressions in when the list pins to bottom.
Overview
Fixes
MessagesTimelineempty-state handling by removing thehasMessagesprop and instead treating the timeline as empty only when there are no rendered rows (so non-message activity rows no longer show the placeholder).Adds an effect that detects the transition from 0 → >0 rows and forces an immediate snap-to-bottom (
requestAnimationFrame+scrollToEnd) while updatingonIsAtEndChange, and introduces a new browser test (MessagesTimeline.browser.tsx) covering both the activity-row empty-state case and the 0 → >0 autoscroll behavior.Reviewed by Cursor Bugbot for commit 2666adb. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix thread timeline autoscroll when first rows appear in MessagesTimeline
MessagesTimelinenow snaps to the bottom (non-animated) and setsisAtEndto true when rows first appear after an initially empty render, using auseRef/useEffectto detect the 0→N rows transition andrequestAnimationFrameto schedule the scroll.hasMessagesprop fromMessagesTimeline; empty-state is now derived fromrows.length === 0internally instead of being passed fromChatView.Macroscope summarized 2666adb.