-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Full Stack Web Development with Remix
By :

The source of truth of a web application is usually stored remotely in a database. We can only be sure that a mutation succeeded after updating the database and receiving confirmation from the server. The UI response to a mutation is thereby delayed until we hear back from the server.
Optimistic UI is a pattern that’s used to provide instant feedback to users while waiting for an execution to resolve. When updating the UI optimistically, we apply a UI update before receiving the definitive response from the server. Most of the time, our mutations succeed, so why wait for a server response? In this section, we will discuss some trade-offs of optimistic UI updates.
Updating the UI optimistically speeds up the perceived response time when the optimistic state aligns with the server response. When the optimistic update does not align with the server response, then optimistic updates need to be rolled back or corrected. This...