Optimistic update Bad
The UI assumes the operation will succeed and shows the result before it’s saved.
Immediate intent Good
The UI never assumes, it always tells you what's actually going on.
Immediate intent can save lives!#
Picture a medication tracker. You take your morning pill 💊, tap Track Pill and close the app. That evening, you open it again, and... didn't I install this app to help me remember?!
Unlike optimistic updates, immediate intent doesn't give you a false sense of safety.
Real cases
- Orders that silently went nowhere. The VA’s new health record system failed to deliver over 11,000 clinical orders and never told the clinicians who sent them. 149 patients were harmed, including a veteran at risk of suicide whose psychiatric follow-up was lost. VA OIG, 2022
- A pump that forgot the last dose. After certain errors, the MiniMed 670G insulin pump showed 0.0 units of active insulin right after a large dose. A user who dosed again risked severe hypoglycemia. FDA recall, 2021
- Insulin skipped without a word. A bug in the Tandem Mobi Android app could drop part of an insulin dose without a distinct alert. FDA recall, 2026
Optimistic updates save waste time.#
Once an app has lied to you, you stop trusting it. So you double-check everything yourself.
Okay, okay... these numbers are not empirically measured, yet I bet you will agree that software you can trust saves you time.
What research says
- One visible error is enough. People avoid an algorithm after seeing it make a mistake, even when it outperforms humans. Dietvorst et al., 2015
- Seeing failures makes people verify. Operators who saw an automated aid fail checked its advice more carefully afterwards. Bahner et al., 2008
- Checking breeds doubt. The more people re-checked, the less they trusted their own memory, even though it stayed just as accurate. van den Hout & Kindt, 2003
Don’t pretend to be fast. Be fast.#
Under about 100 ms, a response feels instant, so you can even skip the pending state when the response arrives that fast. Get there for real, with a faster backend and servers close to your users.
Optimistic updates hide latency. Fast infrastructure removes it.
Make it fast
- Learn what the hardware actually does. A course on writing code that runs fast on real CPUs. Casey Muratori, Computer, Enhance!
- “Clean” code, horrible performance. How popular clean-code rules can make code many times slower. Casey Muratori, 2023
- Find where the time goes. The standard reference on profiling and tuning servers. Brendan Gregg, Systems Performance
- Know your numbers. How long a memory read, a disk seek or a round trip across the world takes. Latency numbers every programmer should know
- Fix the slowest responses. When a request touches many servers, rare slow ones slow down most requests. Dean & Barroso, The Tail at Scale
Move it closer
- You can’t beat the speed of light. Why distance sets a floor on latency, however fast your code is. Ilya Grigorik, High Performance Browser Networking
- See how far away your users are. Real round-trip times between cities around the world. WonderNetwork global pings
- Serve from the edge. How CDNs put content on servers near your users. Cloudflare Learning Center
- Bring the data along. Replication and its trade-offs, for when the database has to be close too. Martin Kleppmann, Designing Data-Intensive Applications
We don't have to block interaction.#
There's no need to freeze the board to remain honest, just show the intent on the card and keep the position. If it fails, return the card to its last confirmed position and explain what happened.
Get the details right
- Cancel what’s outdated. Abort an in-flight request when the user moves the card again. MDN, AbortController
- Ignore late answers. Why an old response can overwrite a newer one, and the simple flag that prevents it. React docs, Fetching data
- Make retries safe. Idempotency keys, from the API that made them popular. Stripe, Designing APIs with idempotency
- Send where, not how. Which requests can be repeated without side effects, and why. MDN, Idempotent
- Don’t overwrite newer changes.
ETagandIf-Matchturn a silent clash into a clear error. MDN, HTTP conditional requests
Make it smooth
- Animate layout changes. The technique behind the sliding cards, fast even on slow devices. Paul Lewis, FLIP Your Animations
- Show what’s pending. React’s
useTransitiongives you anisPendingflag for exactly this. React docs, useTransition - Design the drop. Drop indicators, drag handles and keyboard alternatives. Atlassian, Pragmatic drag and drop
- Respect reduced motion. Tone animations down for people who ask their system for less motion. MDN, prefers-reduced-motion
Agree? Spread the word.
Share this page with your team and give it a star on GitHub. Let’s build reliable software people can trust.
Know a good, harmless use case for optimistic updates?
Let's discuss it, I'm curious!
P.S. even a "like", is not harmless.
Receiving side
- Getting fewer likes than peers causes distress, especially in teens who’ve been bullied. Lee et al., 2020
- Many people care more about who liked their post than how many did. Scissors et al., 2016
- When a Twitter bug dropped like counts, users assumed their tweets were bad. TechCrunch, 2019
Sending side
- People see a like as social support, so a lost like is support your friend never got. Wohn et al., 2016
- A like says as much about the relationship as about the post, so a missing one says something too. Hayes et al., 2016