Fix: Preserve images when follow-up question is answered #10707
Closed
+11
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #10710
Fixes the issue where images attached to the chatbox are cleared when a follow-up question suggestion is clicked or auto-approved.
Problem
When a user attaches an image to the chatbox but has no text, and a follow-up question is triggered, clicking a suggestion (or auto-approval) would clear the attached images from the chatbox.
Root Cause
The
handleSuggestionClickInRowfunction in ChatView.tsx was preserving the input text value but not the selected images. WhenhandleSendMessageis called, it triggershandleChatReset()which clears both input and images. The input text was being restored after the send, but the images were not.Solution
Added a
selectedImagesRefref to track the current selected images state (similar to the existinginputValueRef). When handling follow-up suggestions, both the input text and selected images are now preserved and restored after the message is sent.Changes
selectedImagesRefto track selected images stateselectedImagesRefin sync withselectedImagesstatehandleSuggestionClickInRowto preserve and restore both input text and imagesTesting
View task on Roo Code Cloud
Important
Fixes image clearing issue in
ChatView.tsxby preserving images and input text when follow-up questions are answered.ChatView.tsx.selectedImagesRefto track selected images state inChatView.tsx.useEffectto syncselectedImagesRefwithselectedImagesstate.handleSuggestionClickInRowto restore input text and images after sending a message.This description was created by
for a6d497b. You can customize this summary. It will automatically update as commits are pushed.