Repository navigation
fix: prevent stale loading state on previous agent chat reply - #18124
Conversation
`sendLoading` (= !done) is global — when a new conversation's stream starts it flips to true, and any assistant message matching `derivedMessages.length - 1 === i` lights up the loading indicator, including the previous conversation's reply. - Gate the `loading` prop on `!message.content` so a reply that already has content never shows the loading state. - Scope the `sendLoading` prop passed to MessageItem to the last message only, so LoadingDots (keyed on `sendLoading && isEmpty(content)`) doesn't render on historical replies either. Co-Authored-By: Claude Opus 4.6 <[email protected]>
📝 WalkthroughWalkthroughThe chat message rendering logic now limits ChangesChat loading indicators
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
wangq8
left a comment
There was a problem hiding this comment.
Clean fix, LGTM. The two changes together correctly prevent the stale loading indicator from appearing on previous conversation replies:
!message.contentgate onloading: The previous reply already has content, so it should never show a loading state regardless ofsendLoading.- Scoping
sendLoadingto the last message: PreventsLoadingDots(which renders based onsendLoading && isEmpty(content)) from showing on historical messages too.
The logic is tight and well-reasoned. No regressions — derivedMessages.length - 1 === i is already the guard used for the loading dots block on line 125. Edge case: an empty derivedMessages array would give -1 === i for both conditions, but that is a pre-existing concern, not introduced here.
✅ Approved
Summary
fix: prevent stale loading state on previous agent chat reply
sendLoading(= !done) is global — when a new conversation's stream starts it flips to true, and any assistant message matchingderivedMessages.length - 1 === ilights up the loading indicator, including the previous conversation's reply.loadingprop on!message.contentso a reply that already has content never shows the loading state.sendLoadingprop passed to MessageItem to the last message only, so LoadingDots (keyed onsendLoading && isEmpty(content)) doesn't render on historical replies either.