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.

CONSOLE

LIKELY CAUSES, MOST COMMON FIRST

  1. CAUSE 1

    DOM Event Propagation (Capture, Target, Bubble)

    CHECK IN DEVTOOLS

    Three-phase DOM event traversal from window to target and back, enabling single-listener delegation on common ancestors.

  2. CAUSE 2

    Debounce, Throttle & rAF Coalescing

    CHECK IN DEVTOOLS

    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.

  3. CAUSE 3

    Finite State Machines for UI

    CHECK IN DEVTOOLS

    Replaces overlapping boolean flags (isLoading, isError, isRetrying) with a discriminated union and explicit (state, event) transition table that makes invalid states unrepresentable.

  4. CAUSE 4

    AbortController and Cooperative Cancellation

    CHECK IN DEVTOOLS

    Kill-switch for in-flight fetch calls, DOM listeners, and async tasks you should have stopped three renders ago—without boolean isMounted flags.

  5. CAUSE 5

    Outbox Queues, Idempotency Keys & Causal Ordering

    CHECK IN DEVTOOLS

    Prevents duplicate charges and out-of-order server overwrites on flaky networks by persisting mutations in an IndexedDB FIFO outbox with UUID idempotency keys.