Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 10, 2025

Summary

This PR fixes issue #7861 where unsent text in the chatbox was being wiped when a queued message was sent.

Problem

When sending is disabled and messages are queued (e.g., waiting for approval), if a user:

  1. Queues a message
  2. Types new text in the chatbox without sending
  3. The queued message sends automatically

The chatbox would be cleared, losing the unsent text the user was typing.

Solution

Modified ChatView.tsx to not clear the input field when queueing messages. Now:

  • When queueing a message, only selected images are cleared
  • The text input is preserved so users can continue typing
  • The input will only be cleared when the message is actually sent (not when queued)

Changes

  • Modified handleSendMessage function in webview-ui/src/components/chat/ChatView.tsx
  • Removed setInputValue("") call when sendingDisabled is true
  • Added comments explaining the behavior

Testing

  • ✅ All existing tests pass
  • ✅ Frontend tests: 1032 passed
  • ✅ Backend tests: 3778 passed
  • ✅ Linting and type checking pass

Related Issue

Fixes #7861


Important

Fixes issue #7861 by preserving chat input in ChatView.tsx when messages are queued, clearing input only when the message is sent.

  • Behavior:
  • Code Changes:
    • Modified handleSendMessage in ChatView.tsx to remove setInputValue("") when sendingDisabled is true.
    • Added comments to clarify input clearing behavior.
  • Testing:
    • All existing tests pass.
    • Frontend tests: 1032 passed.
    • Backend tests: 3778 passed.
    • Linting and type checking pass.

This description was created by Ellipsis for 26befa6. You can customize this summary. It will automatically update as commits are pushed.

- Modified ChatView.tsx to not clear input field when queueing messages
- Only clear selected images when queueing, preserving typed text
- Input will be cleared when message is actually sent, not when queued
- Fixes issue where unsent text was wiped when queued messages were sent

Fixes #7861
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 10, 2025 22:20
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Sep 10, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Reviewing my own code is like debugging in a mirror - everything looks backwards but the bugs are still mine.

console.log("queueMessage", text, images)
vscode.postMessage({ type: "queueMessage", text, images })
setInputValue("")
// Don't clear the input when queueing - let the user continue typing
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While this fix correctly addresses the issue, consider adding a test to verify that input text is preserved when messages are queued. The existing tests in ChatView.spec.tsx don't specifically cover this behavior.

You could add a test like:

Suggested change
// Don't clear the input when queueing - let the user continue typing
it("preserves input text when queueing messages", async () => {
// Test that setInputValue("") is not called when sendingDisabled is true
// and that only setSelectedImages([]) is called
})

if (sendingDisabled) {
try {
console.log("queueMessage", text, images)
vscode.postMessage({ type: "queueMessage", text, images })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider this edge case: What happens if the user modifies the text after queueing but before the message is sent? The current implementation preserves the input, which is correct, but users might not realize their queued message contains different text than what's currently displayed.

Maybe the QueuedMessages component could show a preview of the queued text to make this clearer?

vscode.postMessage({ type: "queueMessage", text, images })
setInputValue("")
// Don't clear the input when queueing - let the user continue typing
// The input will be cleared when the message is actually sent
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice comment explaining the behavior! Consider also documenting this input preservation feature in user-facing documentation or tooltips so users understand that they can continue typing while messages are queued.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 10, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 10, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Chat input is cleared when a queued message is sent

3 participants