Rapid double-click charges the user twice despite disabled button
Asynchronous React state updates lag behind synchronous DOM click dispatch, allowing duplicate mutations unless guarded by state machines and idempotency keys.
Network tab shows 2 concurrent POST /checkout requests within 12 ms before React state flush disables the submit buttonCausal Chain of Browser Mechanisms
Ordered from trigger to root invariant. Open any mechanism to inspect its internals or reproduce the behavior in an interactive lab.
Three-phase DOM event traversal from window to target and back, enabling single-listener delegation on common ancestors.
Separates bursty input rates from execution: debounce waits for quietness (API search), throttle caps interval rate (telemetry), and rAF coalescing aligns visual writes to VSync.
Replaces overlapping boolean flags (isLoading, isError, isRetrying) with a discriminated union and explicit (state, event) transition table that makes invalid states unrepresentable.
Kill-switch for in-flight fetch calls, DOM listeners, and async tasks you should have stopped three renders ago—without boolean isMounted flags.
Prevents duplicate charges and out-of-order server overwrites on flaky networks by persisting mutations in an IndexedDB FIFO outbox with UUID idempotency keys.