Optimistic UI rollback strategy
Slap yourself if
You think rollback just means ‘revert to previous state’ and call it done.
Why this exists
Optimistic UIs exist to hide latency, but failures are inevitable. Rollback strategies exist because naive optimism corrupts state, breaks user trust, and creates bugs that only appear under partial failure or reordering.
Mental model
Optimistic UI is a speculative timeline. Rollback is not undo — it’s reconciling speculation with reality while preserving user intent.
- The UI applies a speculative state update before server confirmation.
- Multiple optimistic updates may stack before any response arrives.
- Server responses arrive out of order or partially fail.
- The client must reconcile confirmed, rejected, and pending intent.
- Blindly reverting to a snapshot and discarding later user actions.
- Assuming one optimistic action is in flight at a time.
- Coupling rollback logic to network success instead of intent.
- Treating rollback as a visual concern instead of a state concern.
An optimistic UI rollback strategy defines how speculative state updates are reconciled with eventual server responses, preserving user intent while correcting invalid assumptions without corrupting state.
- Single global ‘previousState’ snapshot
- Optimistic updates without identifiers or ordering
- Rollback logic inside UI components
- Assuming failures are rare edge cases
Deep dive
Requires Pro
Premium deep dives include more internals, more scars.