fix(webmail): Undo send really undoes, and a send is not made twice

The countdown sent from inside a state updater and Undo's button submitted the
form, so Undo stopped the timer and then started the send over. The timer is
now held in a ref, Undo is type=button, and leaving the screen flushes a
pending send once. Snippets drop a stylesheet the preview was cut inside of.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Sonnet 5.5 committed 2026-10-22 22:05:43 -03:00
1 parent 2080489319
commit 897f0122f4
5 files changed
+97 -12

No files matched your search

+11
View File
@@ -35,6 +35,17 @@
"drafts"
],
"date": "2026-10-22"
},
{
"error_message": "Undo send did not undo: the message was sent anyway (and twice in development)",
"root_cause": "The 10-second countdown sent the message from inside a setUndoSeconds updater. Undo only set the number to null; the interval kept running, its next tick saw prev === null and sent. React may also run an updater twice",
"fix": "The countdown is counted in a plain closure with the timer kept in pendingSend; handleUndo clears it; leaving the screen flushes a pending send once (and does not navigate). Covered by compose-draft-integrity.test.ts",
"tags": [
"webmail",
"compose",
"undo-send"
],
"date": "2026-10-22"
}
]
}