From b9e7ecf37f832011252a54c78722c583c78f9132 Mon Sep 17 00:00:00 2001 From: Chris Hasson Date: Fri, 25 Jul 2025 12:49:48 -0700 Subject: [PATCH] fix(chat): Prevent input clearing when clicking chat buttons The chat box is no longer cleared when clicking buttons Previously, we had a bug where if either of the buttons in the agent chat was clicked, the ChatTextArea would get cleared. Now, the text box will only get cleared if the message is sent as part of the response. Moved input clearing logic to only execute when a message is successfully sent, preventing the input field from clearing prematurely when clicking "yes" or "no" buttons in the chat interface. This improves user experience by retaining the input content if an action fails or requires further interaction Fixes #1520 --- .changeset/calm-pears-fry.md | 7 +++++++ webview-ui/src/components/chat/ChatView.tsx | 16 ++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 .changeset/calm-pears-fry.md diff --git a/.changeset/calm-pears-fry.md b/.changeset/calm-pears-fry.md new file mode 100644 index 0000000000..bf53d43a7f --- /dev/null +++ b/.changeset/calm-pears-fry.md @@ -0,0 +1,7 @@ +--- +"kilo-code": patch +--- + +The chat box is no longer cleared when clicking buttons + +Previously, if either of the buttons in the agent chat was clicked, the ChatTextArea would get cleared. Now, the ChatTextArea will only get cleared if a message is sent as part of the response. diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index ad53628041..c73db4dfff 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -658,12 +658,12 @@ const ChatViewComponent: React.ForwardRefRenderFunction handlePrimaryButtonClick(inputValue, selectedImages)}> + onClick={() => handlePrimaryButtonClick()}> {primaryButtonText} @@ -1931,7 +1931,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction handleSecondaryButtonClick(inputValue, selectedImages)}> + onClick={() => handleSecondaryButtonClick()}> {isStreaming ? t("chat:cancel.title") : secondaryButtonText}