Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Optimistic Updates (feature request) #20

Open
briandpassa opened this issue Jul 3, 2016 · 3 comments
Open

Support for Optimistic Updates (feature request) #20

briandpassa opened this issue Jul 3, 2016 · 3 comments

Comments

@briandpassa
Copy link

Currently, updates to store state which is a client representation of a service is performed by calling 'onCreated', 'onUpdated', 'onRemoved' functions once the service call is successful.

Do you plan to implement optimistic update where the state is immediately updated assuming service call would be successful, and revert the update if the service call was not successful. Something like in Meteor or redux-optimistic-ui.

@foxhound87
Copy link
Owner

The Optimistc UI is something of sophisticated piece of technology. I think would be hard to accomplish with a standard implementation because it depends on specific state the client is, so you can implement it maually for now.

Example: creating a realtime chat, you should be able to send a message to another user and immediately see your message in the messages list even if the service call is not successful and marking it as not received from the user if it has a timeout (which is 5000ms in feathers client as default).

Those mechanisms requires specific UI updates, and without a correct implementation it may result in an inconsistent UI state.
For example if the service fails, the unsent message should be marked with a warning icon that works as a resend button, or should be removed after the timeout if a warning is not provided.

However in the documentation of feathers they said:
http://docs.feathersjs.com/why/vs/meteor.html

Meteor has optimistic UI rendering and oplog tailing whereas currently Feathers leaves that up to the developer. However, we've found that being universal and utilizing websockets for both sending and receiving data alleviates the need for optimistic UI rendering and complex data diffing in most cases.

But I think that an implementation of standard mechanisms should be cool to have :D
So, although I have a lot on my todo list, I will deepen this argument in the future.

@briandpassa
Copy link
Author

Noted. I am doing manually too for now for some update.

@foxhound87
Copy link
Owner

foxhound87 commented Jul 3, 2016

I also noticed that redux-optimistic-ui is based on the time-travel functionalities of redux, which is not yet implemented in MobX. A standardized time travelling mechanism is on the MobX roadmap for the future releases. mobxjs/mobx#323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants