Skip to content

Graphcache - Invalidate Document #2273

Answered by kitten
ragokan asked this question in Q&A
Discussion options

You must be logged in to vote

I don quite know what your query is obviously, but when you login, you can't invalidate what's already being returned. So, if your login mutation returns a User there's in theory no need to invalidate anything for the query that contains the user, unless the ID changes, which means you could use cache.link to update the field

If you're only after updating a single field, e.g. Query.user without arguments, let's say then you'd likely want to use: cache.invalidate('Query', 'user')
If you're only looking to update said field you could use cache.link on login to make sure the key is up-to-date using: cache.link('Query', 'user', login)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ragokan
Comment options

Answer selected by JoviDeCroock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants