Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for Normalized Cache and Optimistic responses #1163

Closed
moritzmorgenroth opened this issue Dec 23, 2018 · 4 comments
Closed

Documentation for Normalized Cache and Optimistic responses #1163

moritzmorgenroth opened this issue Dec 23, 2018 · 4 comments

Comments

@moritzmorgenroth
Copy link

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!

@digitalbuddha
Copy link
Contributor

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
Copy link
Contributor

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

@moritzmorgenroth
Copy link
Author

@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!

@digitalbuddha
Copy link
Contributor

I would use the refetchQueries mechanism which will allow you to say which queries to refetch when the mutation happens. Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants