Skip to content

Bug: Images cleared from chatbox when follow-up question is triggered with no text #10710

@roomote

Description

@roomote

Description

When an image is attached to the chatbox but no text is in the context, and a follow-up question is triggered, clicking a suggestion or auto-approval clears the attached images from the chatbox.

Steps to Reproduce

  1. Attach an image to the chatbox
  2. Do not enter any text in the chatbox
  3. Trigger a follow-up question (either through a suggestion or auto-approval)
  4. Click on a follow-up suggestion
  5. Observe that the attached images are cleared

Expected Behavior

The attached images should be preserved when follow-up question suggestions are clicked, just like the input text is preserved.

Root Cause

The handleSuggestionClickInRow function in ChatView.tsx was preserving the input text value but not the selected images. When handleSendMessage is called, it triggers handleChatReset() which clears both input and images. The input text was being restored after the send, but the images were not.

Fix

Fixed in PR #10707 by:

  • Adding selectedImagesRef to track selected images state
  • Adding useEffect to keep selectedImagesRef in sync with selectedImages state
  • Modified handleSuggestionClickInRow to preserve and restore both input text and images

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions