Pessimistic vs Optimistic: When to Choose
What you'll learn: How to decide between instant user feedback (optimistic) and wait-for-confirmation (pessimistic) mutation strategies.
The Core Decision
When a user performs an action (like updating a post or toggling a favorite), you have two approaches:
Pessimistic updates wait for the server to confirm success before updating the UI. The user sees a loading state, then the result. It's safe but slower-feeling.
Optimistic updates instantly update the UI as if the server will succeed, then roll back if it fails. It's fast-feeling but riskier.
When to Choose Pessimistic
Use pessimistic updates when:
- Consequences of failure are severe — Deleting an account, processing payments, or permanent actions
- Server validation is complex — The server might reject the request for non-obvious reasons (permissions, business rules)
- Rollbacks would be jarring — If showing success then yanking it away would confuse users more than waiting
- Network is unreliable — High failure rates make optimistic updates frustrating
Think: Would a false positive (showing success that fails) harm trust or workflow?
When to Choose Optimistic
Use optimistic updates when:
- Actions are low-stakes — Liking a post, marking as read, simple toggles
- Success is highly likely — The server rarely rejects these requests
- Speed perception matters — Social feeds, chat apps, collaborative tools where instant feedback is expected
- Rollback is easy to communicate — A brief error toast is acceptable
Think: Would waiting for confirmation make the app feel sluggish?
The Hybrid Approach
Many apps use both: optimistic for everyday interactions (likes, favorites) and pessimistic for critical actions (delete, publish, pay). This balances speed with safety.
Key Takeaway: Choose optimistic updates for low-risk, high-frequency actions where speed matters; choose pessimistic for high-stakes operations where confirmation is essential. Match the strategy to user expectations and consequences.