From 915ab12c40d17ee168abfff2792fb82a1fd489ee Mon Sep 17 00:00:00 2001 From: Dani Akash Date: Thu, 5 Mar 2026 21:01:57 +0530 Subject: [PATCH] fix: prevent sending multiple messages when chat is running (#409) --- apps/agent/entrypoints/sidepanel/index/ChatInput.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/agent/entrypoints/sidepanel/index/ChatInput.tsx b/apps/agent/entrypoints/sidepanel/index/ChatInput.tsx index dbeff190..27946e2a 100644 --- a/apps/agent/entrypoints/sidepanel/index/ChatInput.tsx +++ b/apps/agent/entrypoints/sidepanel/index/ChatInput.tsx @@ -147,12 +147,18 @@ export const ChatInput = forwardRef( [closeMention, openMentionAtCursor, toggleMentionAtCursor], ) + const isBusy = status !== 'ready' && status !== 'error' + const handleSubmit = (e: FormEvent) => { if (mentionStateRef.current.isOpen) { e.preventDefault() closeMention() return } + if (isBusy) { + e.preventDefault() + return + } onSubmitProp(e) } @@ -229,7 +235,7 @@ export const ChatInput = forwardRef( !e.nativeEvent.isComposing ) { e.preventDefault() - if (input.trim()) { + if (input.trim() && !isBusy) { e.currentTarget.form?.requestSubmit() } } @@ -280,7 +286,7 @@ export const ChatInput = forwardRef( } rows={1} /> - {status === 'streaming' ? ( + {isBusy ? (