reactjs/react-tutorial

Race condition in refresh code

daxfohl opened this issue · 1 comments

If you POST a new comment at the same time you poll, the optimistic GUI update occurs, then if the poll returns before the POST, it'll cause the comment on the GUI to disappear again until the POST returns. So you get a little flash before the comment appears permanently.

zpao commented

Thanks for noticing, you are now ready to go build your own version that handles that better 😀. This is not meant to be a production ready and resilient application, only an example for educative purposes. We wanted to focus on the React part as much as possible and not spend too much time making a big deal about the data fetching and server-side aspects.