27 Optimistic UI. 27 of 95.

27/PERCEIVED PERFORMANCE/27 of 95

Optimistic UI

Be fast when you can, honest when you can't.

The problem

Waiting for the server freezes the UI — but updating instantly without a failure path leaves people confused when the request is rejected.

The solution

Update UI immediately; on failure, roll back and explain.

Experiment

Play with the values

1500ms
0.3

How it works

  • The click is treated as the user's decision immediately, before the network answers.
  • The interface updates local state so the result is visible without waiting on the server.
  • The same action is sent to the server in the background.
  • A successful response confirms the change that is already on screen.
  • A failure rolls the interface back and explains what happened, so speed never hides an error.

Seen in

Like buttons

The heart fills instantly on tap while the server request runs in the background.

Save toggles

Bookmark or save state flips immediately so the action feels acknowledged.

Star ratings

Stars highlight on click before the rating is persisted, with rollback if the request fails.

Follow buttons

Follow state updates at once; a failed request quietly reverts instead of blocking the UI.

References