rfx-stack
rfx-stack copied to clipboard
Support for Optimistic Updates (feature request)
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.
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.
Noted. I am doing manually too for now for some update.
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. https://github.com/mobxjs/mobx/issues/323