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] recommend using typePolicies instead of writeQuery/writeFragment whenever possible #6036

Closed
jedwards1211 opened this issue Mar 9, 2020 · 2 comments

Comments

@jedwards1211
Copy link
Contributor

I'm happy to make a PR for this eventually, just bringing this up because I don't have time atm...

I went years without knowing about cacheRedirects and thinking writeQuery/writeFragment was the only way to accomplish what I needed. The docs don't raise enough awareness of this feature.

This is still a problem in v3 since the Local State Management docs don't mention typePolicies. We should add a note above the Updating local state section, something like

In many cases, using typePolicies to customize cache reads is easier and more maintainable than manually reading or writing local state. For example, after querying a list of users, if you want a query for one of those users by id to be served from the cache, this is much easier to accomplish using typePolicies than by doing writeQuery for each user in the list.

@hwillson
Copy link
Member

hwillson commented Mar 9, 2020

Thanks @jedwards1211 - we're currently working on overhauling all docs sections for the upcoming AC3 launch. These changes should start to appear in PR's later this week.

@hwillson
Copy link
Member

Docs changes are happening in #6429 and can be tracked there, so I'll close this off. Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants