Hi,
I was just reading around normalized cache and optimistic responses.
After some digging, I saw that @sav007 created/merged a few features concerning this (last one being, #618).
Is there some documentation or best practice example on how to use these features? Im a little lost and all the apollo android docs seem broken atm.
Generally, I would like to be able to put my mutation results in the cache and reload dependent queries. How can this be implemented?
Any tips?
Thanks!
As this project is run by volunteers, we do not have proper documentation. We do have fantastic test coverage! Take a look at the tests to see if you CA find a good example.
@digitalbuddha Thanks, that actually helps a lot! Im assuming the tests can be used as guidance for the beste practices? One more thing I did not discover in the tests: What is the recommended way to refetch the dependent queries? Should I use a watcher or the refetch mechanism? Thanks a lot!
I would use the refetchQueries mechanism which will allow you to say which queries to refetch when the mutation happens. Enjoy!
Most helpful comment
This might be what you're looking for https://github.com/apollographql/apollo-android/blob/25fe56574d9eb6581ed248476ffaf5bbded658d9/apollo-integration/src/test/java/com/apollographql/apollo/OptimisticCacheTestCase.java