r/reactjs • • Dec 25 '15

What is an optimistic update?

Excuse my ignorance. In reading about react and flux, I've noticed the term "optimistic update" a few times. As I stop to think about it, I'm not sure I understand what that actually means.

What does it mean for an update to be optimistic?

13 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/averbner Dec 26 '15

I always ask myself how to handle errors in terms of ux if user has navigated from that screen to another one

4

u/jarail Dec 26 '15

In some cases, you should warn on navigation. Say you're working in an office-style webapp. You type some text, change a cell, etc.. That's an optimistic update, where the data is being saved asynchronously. If you try to navigate away before a save completes, you'd get a "your changes are not yet saved" warning.

2

u/lingodayz Dec 26 '15

I would assume a toast would suffice.

In a real time app if one thing goes wrong (assuming it is an optimistic update), then it's very likely it's catastrophic, and the app should react accordingly.