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