Interactions · Data fetching
Optimistic Update
Also called: Optimistic UI, Optimistic rendering, Optimistic mutation
After a user action, the UI shows the successful result right away while the request runs in the background. If the request fails, the UI changes back.
In detail
The normal flow is "click → wait for the API → update the UI," and on a slow network it feels laggy. An optimistic update flips that around. It assumes the request will succeed and updates the UI right away (the like count goes up by 1 instantly, the heart fills in instantly), while the request goes out in the background. If it fails in the end, roll back to the previous state and let the user know.
It fits actions that almost always succeed and are easy to recover from if they don't: likes, favorites, checking off a to-do, drag to reorder. It doesn't fit payments, deleting important data, or anything that needs the server to calculate the result. For those, stick with a proper loading state.
When you ask AI for this, spell out "what happens if it fails": what state to roll back to and how to tell the user. Data fetching libraries like React Query and SWR have built-in patterns for optimistic updates.
Developer infoTerm ID, DOM cues, match priority
- Term ID
interaction-optimistic-update- DOM selectors
- No DOM cues. This concept isn't detected directly on a page.
- Priority
- 1 · when several match at the same level, the higher priority wins
- Version
- v1 · updated Sep 29, 2026