From dbf8cd40d3b263440caf2dd890049fbf00c4442b Mon Sep 17 00:00:00 2001 From: Pavel Fediushin Date: Wed, 18 Feb 2026 08:53:22 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=B9=20fix:=20Prevent=20whitespace-only?= =?UTF-8?q?=20Chat=20input=20Submissions=20(#11838)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(input): normalize chat input text before submit Trim input text before checking if empty to show submit button as disabled --- client/src/components/Chat/Input/SendButton.tsx | 3 ++- client/src/hooks/Chat/useChatFunctions.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/components/Chat/Input/SendButton.tsx b/client/src/components/Chat/Input/SendButton.tsx index 14c21f0586..a07e574928 100644 --- a/client/src/components/Chat/Input/SendButton.tsx +++ b/client/src/components/Chat/Input/SendButton.tsx @@ -41,7 +41,8 @@ const SubmitButton = React.memo( const SendButton = React.memo( forwardRef((props: SendButtonProps, ref: React.ForwardedRef) => { const data = useWatch({ control: props.control }); - return ; + const content = data?.text?.trim(); + return ; }), ); diff --git a/client/src/hooks/Chat/useChatFunctions.ts b/client/src/hooks/Chat/useChatFunctions.ts index 30465fc2e5..7cf8c6bf25 100644 --- a/client/src/hooks/Chat/useChatFunctions.ts +++ b/client/src/hooks/Chat/useChatFunctions.ts @@ -97,6 +97,8 @@ export default function useChatFunctions({ ) => { setShowStopButton(false); resetLatestMultiMessage(); + + text = text.trim(); if (!!isSubmitting || text === '') { return; } @@ -134,7 +136,6 @@ export default function useChatFunctions({ // construct the query message // this is not a real messageId, it is used as placeholder before real messageId returned - text = text.trim(); const intermediateId = overrideUserMessageId ?? v4(); parentMessageId = parentMessageId ?? latestMessage?.messageId ?? Constants.NO_PARENT;