Apollo-android: Documentation for Normalized Cache and Optimistic responses

Created on 23 Dec 2018  路  4Comments  路  Source: apollographql/apollo-android

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!

All 4 comments

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!

Was this page helpful?
0 / 5 - 0 ratings