Open wtrocki opened 5 years ago
@wtrocki So this would include->
Please correct me if I'm wrong :).
Applications that have offline support (read, writes) will often experience conflicts, but they can be also simulated. let's not resolve conflict for now. Our target will be just to send update mutation and let's make it to throw conflict all the time by simply calling only: https://github.com/aerogear/voyager-server/blob/master/examples/conflicts/server.js#L62
Then start researching how to do it in mobile app (hint: there will be another layer needed to be created when creating apollo client that will catch this error)
Once that is done we will have basic clue how conflicts can be handled and we can start doing proposals. The suggestion is to refactor app little bit - separate queries out of activity etc.
@wtrocki Just wanted to confirm, you said to use cache on the second call using OkHttp cache, or saving the first call result in the database and then using it for subsequent ones?
The suggestion is to refactor app little bit - separate queries out of activity etc.
Hey, @wtrocki I was thinking of using ViewModels to separate out the queries from the activity; let me know what you think?
I think that we should follow documentation of the Apollo android first. Most importantly https://github.com/apollographql/apollo-android/blob/master/README.md#support-for-cached-responses
Depending on pattern like MVP or something else data layer will look different but we need to make sure that we follow patterns from Apollo docs and other tutorials, blogs using apollo etc.
To provide more context. Cache layer is redundant for this investigation but it is good to have anyway. Please research Apollo Android docs and source code. This should be the main focus. Any Android specific improvements for sample app may obfuscate our intentions so lets keep things simple and focus on results which in this case is to handle conflict that was sent from server.
Edit: I think we could have 2 separate tickets
Follow https://github.com/apollographql/apollo-android/blob/master/README.md#support-for-cached-responses
Low priority for the moment but nice to have
Showcase implements sample conflict resolution but to understand how conflicts work we can build our own or experiment with example application in voyager server