fix(ChatMessages): reset scroll icon when messages are cleared#6239
fix(ChatMessages): reset scroll icon when messages are cleared#6239
Conversation
📝 WalkthroughWalkthroughA guard was added at the start of the throttled watcher in src/runtime/components/ChatMessages.vue. If Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/runtime/components/ChatMessages.vue`:
- Around line 146-151: When the messages array is empty the component resets
scroll-related state but doesn't clear the messagesRefs map, which can retain
stale DOM nodes; update the empty-message branch to also clear messagesRefs
(call messagesRefs.clear()) so the Map is emptied when props.messages has no
length—look for the messagesRefs symbol in ChatMessages.vue and add the clear in
the same conditional that sets showAutoScroll.value, userScrolledUp.value, and
lastScrollTop.value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f066c515-4777-47a9-a57b-a7a6a9756ac6
📒 Files selected for processing (1)
src/runtime/components/ChatMessages.vue
26d03bf to
37f1380
Compare
commit: |
Fixes #6235
The scroll-to-bottom icon stays visible after you clear messages because the
watchThrottledhandler returns early whenstatus !== 'streaming', so the reset never fires.When
messagesgoes empty, resetshowAutoScroll,userScrolledUp,lastScrollTop, andmessagesRefsbefore the status check.