🪹 fix: Prevent whitespace-only Chat input Submissions (#11838)

fix(input): normalize chat input text before submit

Trim input text before checking if empty to show submit button as disabled
This commit is contained in:
Pavel Fediushin 2026-02-18 08:53:22 +07:00 committed by GitHub
parent 2ec64af551
commit dbf8cd40d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -41,7 +41,8 @@ const SubmitButton = React.memo(
const SendButton = React.memo(
forwardRef((props: SendButtonProps, ref: React.ForwardedRef<HTMLButtonElement>) => {
const data = useWatch({ control: props.control });
return <SubmitButton ref={ref} disabled={props.disabled || !data.text} />;
const content = data?.text?.trim();
return <SubmitButton ref={ref} disabled={props.disabled || !content} />;
}),
);