Message submitted twice when pressing Enter rapidly / double-clicking send

Resolved 💬 2 comments Opened Mar 31, 2026 by oierlaraudogoitia Closed May 6, 2026

Version: 2.1.88

Description:
When pressing Enter twice rapidly (or double-clicking the send button), the same message is submitted twice, causing two separate API requests and two responses.

Steps to reproduce:

  1. Type any message in the input box
  2. Press Enter twice very quickly (or double-click the submit button)
  3. The message is sent twice

Root cause:
The submit handler fires synchronously on keypress without any debounce or in-flight guard. When the second Enter fires before React re-renders with the new "loading" state, a second submission goes through.

Suggested fix:
Add a ref-based flag (isSubmitting) that is set synchronously when the first submission fires, and reset when the response completes. A useRef prevents the stale-closure problem that a plain useState would have here.

Environment: macOS 25.2.0 (Darwin), zsh terminal, npm package installation

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗