Optimistic Slow + Failure

Optimistic UIframework/ui ↗

Pending state, commit after delay, rollback + shake on failure, with a NetworkRetryBanner.

Live

ui.OptimisticAction(ui.OptimisticActionConfig{
    Endpoint:     "/api/save-slow",   // ~2s, then 2xx
    IdleLabel:    "Save",
    SuccessLabel: "Saving…",
})
ui.OptimisticAction(ui.OptimisticActionConfig{
    Endpoint:     "/api/save-fail",   // 422
    IdleLabel:    "Save (will fail)",
    SuccessLabel: "Saving…",
})
Save (slow) exercises the pending window — the button is aria-busy + disabled for ~2s, then commits. Save (will fail) flips optimistically, then shakes and reverts when the 4xx lands. Neither auto-retries; for durable retries use a queue + idempotency key.