Making Flux and REST Play Nicely Together
quizlet.com
quizlet.com
On the application I am currently working on we choose the following approach to the problem( were using reflux for Flux implementations, main difference is that actions dispatches them self).
View -> Trigger Action -> Action Creator -> Action creator calls Rest API -> Action sent to Store -> Store receives REST data and creates Immutable versions of it -> Store Triggers immutable version of it`s content to view
This keeps the stores as the "one-true-source" while the action creators does all the communications against the rest-api. Might be that this approach will be to simple when the application is starting to really expand, but I feel we found an easy to maintain, easy to understand and clean solution to the problem.
In a case with lots of data modifications and a final step of "SAVE/CANCEL" whats your reason for not just keep the "current offline state" in the viewmodel-store and submit these when the user clicks SAVE?(If the user clicks CANCEL on can just reload the initial state from the REST service). This would perform the same task with lots of complexity removed.
But if you have discussed all the possible problems above, whats your strategy for keeping the server/view-models properties in sync? Seems like a lots of work just handling that.