fix: preserve pasted images in chatbox during chat activity #11375
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.
Related GitHub Issue
Closes:
Roo Code Task Context (Optional)
View task on Roo Code Cloud
Description
When a user pastes an image into the chatbox while a chat is in progress (the AI is actively responding), the image gets cleared every time a new
api_req_startedmessage arrives from the backend.Root cause: In the
useDeepCompareEffecthandler inChatView.tsx, theapi_req_startedsay handler calledsetSelectedImages([])to "clear button state." This fires every time the backend starts a new API call during task processing, which aggressively wipes any images the user has pasted into the chatbox while waiting.Fix: Removed the
setSelectedImages([])call from theapi_req_startedhandler. Images are already properly cleared in all user-initiated action handlers:handleSendMessage(after sending/queuing)handlePrimaryButtonClick(after sending with input)handleSecondaryButtonClick(after sending with input)handleChatReset(when starting fresh)The
api_req_startedhandler reacts to backend activity and should not touch user input state.Test Procedure
ChatView.preserve-images.spec.tsxwith 3 tests:selectedImagesis NOT cleared whenapi_req_startedfiresapi_req_startedmessagesPre-Submission Checklist
Screenshots / Videos
N/A - Logic-only change, no UI modifications.
Documentation Updates
Additional Notes
The change is minimal: one line removed from
ChatView.tsx(line 459:setSelectedImages([])), replaced with a comment explaining why images should not be cleared here.Get in Touch
N/A - Automated contribution via Roo Code Cloud
Important
Fixed image clearing issue in chatbox during chat activity by removing the setSelectedImages call from the api_req_started handler in ChatView.tsx, with new tests to verify images persist through API calls.
Related GitHub Issue
Closes:
Roo Code Task Context (Optional)
View task on Roo Code Cloud
Description
When a user pastes an image into the chatbox while a chat is in progress (the AI is actively responding), the image gets cleared every time a new
api_req_startedmessage arrives from the backend.Root cause: In the
useDeepCompareEffecthandler inChatView.tsx, theapi_req_startedsay handler calledsetSelectedImages([])to "clear button state." This fires every time the backend starts a new API call during task processing, which aggressively wipes any images the user has pasted into the chatbox while waiting.Fix: Removed the
setSelectedImages([])call from theapi_req_startedhandler. Images are already properly cleared in all user-initiated action handlers:handleSendMessage(after sending/queuing)handlePrimaryButtonClick(after sending with input)handleSecondaryButtonClick(after sending with input)handleChatReset(when starting fresh)The
api_req_startedhandler reacts to backend activity and should not touch user input state.Test Procedure
ChatView.preserve-images.spec.tsxwith 3 tests:selectedImagesis NOT cleared whenapi_req_startedfiresapi_req_startedmessagesPre-Submission Checklist
Screenshots / Videos
N/A - Logic-only change, no UI modifications.
Documentation Updates
Additional Notes
The change is minimal: one line removed from
ChatView.tsx(line 459:setSelectedImages([])), replaced with a comment explaining why images should not be cleared here.Get in Touch
N/A - Automated contribution via Roo Code Cloud
This description was created by
for 7dd7949. You can customize this summary. It will automatically update as commits are pushed.