From bec059f7b22a98059a878706ab3f27b6d2bc53bc Mon Sep 17 00:00:00 2001 From: Val Alexander Date: Sun, 22 Feb 2026 06:11:16 -0600 Subject: [PATCH] fix(ui): ensure correct draft value in chat input handling --- ui/src/ui/views/chat.ts | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/ui/src/ui/views/chat.ts b/ui/src/ui/views/chat.ts index cd53e35189a..05a83923871 100644 --- a/ui/src/ui/views/chat.ts +++ b/ui/src/ui/views/chat.ts @@ -772,9 +772,12 @@ export function renderChat(props: ChatProps) { const handleInput = (e: Event) => { const target = e.target as HTMLTextAreaElement; adjustTextareaHeight(target); - props.onDraftChange(target.value); updateSlashMenu(target.value, requestUpdate); inputHistory.reset(); + // onDraftChange must be last: requestUpdate() inside updateSlashMenu + // uses the stale render-time props.draft, overwriting chatMessage. + // Calling onDraftChange last ensures the correct DOM value wins. + props.onDraftChange(target.value); }; return html` @@ -963,22 +966,6 @@ export function renderChat(props: ChatProps) { - ${ - props.messages.length > 0 - ? html` - - - - - ` - : nothing - } ${ canAbort && isBusy