Skip to content

Commit 4f32fc1

Browse files
hassoncsChris Hassondaniel-lxs
authored andcommitted
fix(chat): Prevent input clearing when clicking chat buttons (RooCodeInc#6222)
Co-authored-by: Chris Hasson <[email protected]> Co-authored-by: Daniel <[email protected]>
1 parent fb72ccb commit 4f32fc1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -731,12 +731,12 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
731731
text: trimmedInput,
732732
images: images,
733733
})
734+
// Clear input state after sending
735+
setInputValue("")
736+
setSelectedImages([])
734737
} else {
735738
vscode.postMessage({ type: "askResponse", askResponse: "yesButtonClicked" })
736739
}
737-
// Clear input state after sending
738-
setInputValue("")
739-
setSelectedImages([])
740740
break
741741
case "completion_result":
742742
case "resume_completed_task":
@@ -786,13 +786,13 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
786786
text: trimmedInput,
787787
images: images,
788788
})
789+
// Clear input state after sending
790+
setInputValue("")
791+
setSelectedImages([])
789792
} else {
790793
// Responds to the API with a "This operation failed" and lets it try again
791794
vscode.postMessage({ type: "askResponse", askResponse: "noButtonClicked" })
792795
}
793-
// Clear input state after sending
794-
setInputValue("")
795-
setSelectedImages([])
796796
break
797797
case "command_output":
798798
vscode.postMessage({ type: "terminalOperation", terminalOperation: "abort" })
@@ -1912,7 +1912,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
19121912
appearance="primary"
19131913
disabled={!enableButtons}
19141914
className={secondaryButtonText ? "flex-1 mr-[6px]" : "flex-[2] mr-0"}
1915-
onClick={() => handlePrimaryButtonClick(inputValue, selectedImages)}>
1915+
onClick={() => handlePrimaryButtonClick()}>
19161916
{primaryButtonText}
19171917
</VSCodeButton>
19181918
</StandardTooltip>
@@ -1934,7 +1934,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
19341934
appearance="secondary"
19351935
disabled={!enableButtons && !(isStreaming && !didClickCancel)}
19361936
className={isStreaming ? "flex-[2] ml-0" : "flex-1 ml-[6px]"}
1937-
onClick={() => handleSecondaryButtonClick(inputValue, selectedImages)}>
1937+
onClick={() => handleSecondaryButtonClick()}>
19381938
{isStreaming ? t("chat:cancel.title") : secondaryButtonText}
19391939
</VSCodeButton>
19401940
</StandardTooltip>

0 commit comments

Comments
 (0)