My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How should you go about updating your UI? Optimistically, or pessimistically?

Juanita Sutton's photo
Juanita Sutton
·Aug 16, 2016

Instant UI Update: Completely optimistic

23%

"Updating" State: Partially pessimistic

32%

OnlyAfterSuccess: Completely pessimistic

13%

Depends

31%

77 votes · Closed

I have recently come across these terms: optimistic, and pessimistic UI updates; for updates in UI, after user actions which also involve changes in the backend. Usually a corresponding API is hit through an AJAX call, and the corresponding CRUD operation is done in the backend.

Which option, out of the following, would you pick when considering an update in the UI, in such cases:

  • Instantly make the update in the UI, making the change look instantaneous; and being optimistic that your update would also get reflected in the backend

  • Show an "updating" state, until you receive a confirmation from the backend that the update has succeeded - Partially optimistic/pessimistic.

  • Or to go through a completely pessimistic way, only update the UI after you receive a success response from the server.

Which one would you choose, and why; and if you have chosen "Depends", can you expand upon your answer; your thought process while approaching this whole UI update thing?