Bug library · concurrency · flow
Double submit
The Pay button stays enabled while processing and each click gets a new idempotency key, so a double click creates two orders.
The diff
components/Checkout.tsx- body: JSON.stringify({ cart: lines, coupon, ...details, idempotencyKey: idempotencyKey.current }),+ body: JSON.stringify({ cart: lines, coupon, ...details, idempotencyKey: newKey() }),
components/PaymentForm.tsx- if (pending || disabled) return;+ if (disabled) return;
components/PaymentForm.tsx- className="primary" disabled={disabled || pending}+ className="primary" disabled={disabled}