Fix: Rapid clicking results in multiple message requests being sent. (#16739)

This commit is contained in:
balibabu
2026-07-09 09:57:54 +08:00
committed by GitHub
parent 3ec9187cd2
commit 575984877f
5 changed files with 9 additions and 6 deletions

View File

@@ -126,10 +126,10 @@ export function NextMessageInput({
}, []);
const submit = React.useCallback(() => {
if (isUploading) return;
if (isUploading || sendLoading) return;
pressEnter();
setFiles([]);
}, [isUploading, pressEnter]);
}, [isUploading, sendLoading, pressEnter]);
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && !e.shiftKey) {
@@ -222,6 +222,7 @@ export function NextMessageInput({
"
disabled={isUploading || disabled || sendLoading}
onKeyDown={handleKeyDown}
resize={resize}
autoSize={{ minRows: 2, maxRows: 8 }}
/>