Skip to content

fix(ChatMessages): reset scroll icon when messages are cleared#6239

Open
howwohmm wants to merge 1 commit intonuxt:v4from
howwohmm:fix/chat-messages-scroll-icon
Open

fix(ChatMessages): reset scroll icon when messages are cleared#6239
howwohmm wants to merge 1 commit intonuxt:v4from
howwohmm:fix/chat-messages-scroll-icon

Conversation

@howwohmm
Copy link
Contributor

@howwohmm howwohmm commented Mar 24, 2026

Fixes #6235

The scroll-to-bottom icon stays visible after you clear messages because the watchThrottled handler returns early when status !== 'streaming', so the reset never fires.

When messages goes empty, reset showAutoScroll, userScrolledUp, lastScrollTop, and messagesRefs before the status check.

@howwohmm howwohmm requested a review from benjamincanac as a code owner March 24, 2026 19:31
@github-actions github-actions bot added the v4 #4488 label Mar 24, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

A guard was added at the start of the throttled watcher in src/runtime/components/ChatMessages.vue. If props.messages is absent or empty, the watcher now sets showAutoScroll to false, userScrolledUp to false, lastScrollTop to 0, clears messagesRefs.value, and returns early, preventing subsequent streaming and auto-scroll checks from running when there are no messages.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: resetting the scroll icon when messages are cleared, which is the primary objective of the changeset.
Linked Issues check ✅ Passed The pull request fully implements the proposed fix from issue #6235: resetting showAutoScroll, userScrolledUp, and lastScrollTop when messages array is empty, before the streaming status check.
Out of Scope Changes check ✅ Passed All changes in ChatMessages.vue are directly scoped to fixing the scroll icon visibility issue by adding an early guard for empty messages, with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly and accurately describes the changeset, explaining the bug fix and referencing the related issue.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 90a94fb and 26d03bf.

📒 Files selected for processing (1)
  • src/runtime/components/ChatMessages.vue

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 26, 2026

npm i https://pkg.pr.new/@nuxt/ui@6239

commit: 37f1380

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UChatMessages scroll icon remains visible after messages are cleared

1 participant