From 91f3dd90fb73bcb435e3eceaed68710f6a28b587 Mon Sep 17 00:00:00 2001 From: Daniel <57051444+daniel-lxs@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:18:08 -0500 Subject: [PATCH] fix: preserve user input when selecting follow-up choices (#7394) --- webview-ui/src/components/chat/ChatView.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index d2a053b07f..44eeb33b66 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -166,6 +166,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction getApiMetrics(modifiedMessages), [modifiedMessages]) const [inputValue, setInputValue] = useState("") + const inputValueRef = useRef(inputValue) const textAreaRef = useRef(null) const [sendingDisabled, setSendingDisabled] = useState(false) const [selectedImages, setSelectedImages] = useState([]) @@ -207,6 +208,11 @@ const ChatViewComponent: React.ForwardRefRenderFunction { + inputValueRef.current = inputValue + }, [inputValue]) + useEffect(() => { isMountedRef.current = true return () => { @@ -1493,7 +1499,12 @@ const ChatViewComponent: React.ForwardRefRenderFunction