Optimistic updates
Showing a result before the server confirms it feels fast, but sometimes it tells people something happened that did not.
The answer
Show results early only for small, reversible actions. Wait for the server for anything that matters. As strong as the weakest rule behind it: weak.
-
Show the result before the server confirms only when the action almost always works, is easy to undo, and people’s next step doesn’t depend on it.
Documentation and one essay agree; none reports a test. The Google delay experiment shows small delays cost use, but it did not test optimistic display, so it lends no rating here.
- Applies when
- An action is sent to a server and its result could be drawn at once.
- Based on
- Practitioner research
- Depends on
- Whether it can be undone, What a mistake costs
- Principle
- Keep people informed
- GuidanceGuidance: Optimistic Actions (Speed Patterns)Joseph Gannon and Sergey Chernyshev, 2020
- Guidance: Web Interface Guidelines (Vercel), optimistic update and feedback itemsVercel
- Guidance: useOptimistic (React reference)React team
-
Wait for the server before showing success for payments, security changes, legal actions and anything that can’t be undone.
One essay states it and it follows from the reversibility condition in rule 1. Inference, not tested.
- Applies when
- The action is high-stakes or irreversible.
- Based on
- Reasoned, not tested
- Depends on
- Whether it can be undone, What a mistake costs
- Principle
- Prevent errors
- Common mistake
- Showing success for a payment before the server confirms it.
- GuidanceGuidance: Optimistic Actions (Speed Patterns)Joseph Gannon and Sergey Chernyshev, 2020
- Guidance: Web Interface Guidelines (Vercel), optimistic update and feedback itemsVercel
The other rules
-
If an error message appears without moving focus, make sure screen readers announce it.
WCAG 2.2 success criterion 4.1.3, level AA.
- Applies when
- A rollback message appears while focus stays where it was.
- Based on
- Standard or law
- Principle
- Work for everyone
- StandardStandard: Understanding SC 4.1.3 Status Messages (Level AA)W3C WAI
-
If the server rejects the action, restore the earlier state, say what failed, and offer Try again.
React reverts the display on failure but shows no message unless one is written; Vercel says to show the error and roll back or offer undo. No study.
- Applies when
- An optimistic update fails.
- Based on
- Practitioner research
- Principle
- Help people recover from errors
- Common mistake
- Reverting the display on failure without saying anything.
- GuidanceGuidance: useOptimistic (React reference)React team
- Guidance: Web Interface Guidelines (Vercel), optimistic update and feedback itemsVercel
-
Mark new items as pending until the server confirms. Leave simple toggles unmarked.
React documentation shows a pending marker as one option. No source compares marking against not marking.
- Applies when
- A new or changed item is shown optimistically.
- Based on
- Convention
- Principle
- Keep people informed
- GuidanceGuidance: useOptimistic (React reference)React team
-
When someone else’s change conflicts, show the server’s value and say this person’s change wasn’t saved.
React says the server value replaces the guess. No source found on how to tell the person.
- Applies when
- Several people can change the same data.
- Based on
- Convention
- Principle
- Keep people informed
- GuidanceGuidance: useOptimistic (React reference)React team
Accessibility
- WCAG 2.2 · 4.1.3Failure and rollback messages are status messages under WCAG 4.1.3.
- A silent rollback is invisible to a screen reader user; the message is the only signal.
Open questions
- OpenDoes optimistic display change use, errors or trust compared with a short wait? No study found.
- OpenHow often can an optimistic update fail before people stop trusting it?
- OpenHow should conflicts with other users be shown?
Sources
- StandardStandard: Understanding SC 4.1.3 Status Messages (Level AA)W3C WAI
- GuidanceGuidance: Optimistic Actions (Speed Patterns)Joseph Gannon and Sergey Chernyshev, 2020
- Guidance: Web Interface Guidelines (Vercel), optimistic update and feedback itemsVercel
- Guidance: useOptimistic (React reference)React team
Related
- Response time thresholdsTreat every delay as a cost, and acknowledge every input at once.Answer: moderate.
- Success confirmationSay what happened and what comes next, where people will notice it.Answer: weak.
- Confirming vs undoing a destructive actionAct at once and offer undo. Ask “are you sure?” only when it truly cannot be undone and is rare.Answer: moderate.
- Offline and failure statesSay plainly what went wrong and what people can do, and keep what they entered.Answer: moderate.