fix(chat): prevent double send on mobile by removing redundant submit handlers (#719)

PromptInputSubmit already has type="submit" via the parent form, so the
button's click triggers handleSubmit through the form's onSubmit path.
The added onMouseDown/onTouchStart handlers created two extra paths that
both invoked handleSubmit; on iOS Safari a single tap could fire both
touchstart and a synthetic mousedown before isLoading state propagated,
producing two messages and two image-upload roundtrips.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Peter Buchegger
2026-05-30 14:50:45 +02:00
committed by GitHub
parent 38bf21ddf5
commit dbc41dc91d

View File

@@ -401,14 +401,6 @@ export default function ChatComposer({
<PromptInputSubmit <PromptInputSubmit
disabled={!input.trim() || isLoading} disabled={!input.trim() || isLoading}
className="h-10 w-10 sm:h-10 sm:w-10" className="h-10 w-10 sm:h-10 sm:w-10"
onMouseDown={(event) => {
event.preventDefault();
onSubmit(event as unknown as MouseEvent<HTMLButtonElement>);
}}
onTouchStart={(event) => {
event.preventDefault();
onSubmit(event as unknown as TouchEvent<HTMLButtonElement>);
}}
/> />
</div> </div>
</PromptInputFooter> </PromptInputFooter>