fix(chat): prevent double send on mobile by removing redundant submit handlers#719
fix(chat): prevent double send on mobile by removing redundant submit handlers#719peterus wants to merge 1 commit intositeboon:mainfrom
Conversation
… handlers 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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe Changes
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Removes redundant direct-submit event handlers on the chat send button so message submission occurs through the form’s single onSubmit path, preventing double-send on mobile (notably iOS Safari).
Changes:
- Removed
onMouseDownandonTouchStarthandlers fromPromptInputSubmitusage to eliminate multiple submit paths.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for this PR. I am having the same issue in Chrome on Android. |
Summary
PromptInputSubmitis rendered astype=\"submit\"inside a<form>whoseonSubmitalready invokeshandleSubmit. The component additionally wiredonMouseDownandonTouchStartto callonSubmitdirectly, creating three submit paths.On iOS Safari a single tap fires
touchstartand a syntheticmousedownbefore React state propagatesisLoading=true, so thedisabled={!input.trim() || isLoading}guard does not catch the second invocation. Result: two user messages, two image-upload roundtrips per tap (visible as duplicate.tmp/images/<timestamp>folders).This PR removes the redundant
onMouseDown/onTouchStarthandlers; the form'sonSubmitis the single, browser-debounced submit path.Test plan
.tmp/images/<ts>folderdisabledstate still gates submission whileisLoading🤖 Generated with Claude Code
Summary by CodeRabbit