Networking·Intermediate·Conceptual·1 min read
How should optimistic updates handle failure?
Short interview answer
Apply the change to the local cache immediately, keep the previous value, send the request, and if it fails, roll the cache back to the previous value and surface an error. Skipping the rollback path leaves the UI showing a change the server rejected.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.