Skip to content

Optimistic cache update for a nested structure #3309

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

You must be logged in to vote

createAnnotationNode needs to return at least a partial result for the mutation, as of the latest version. I can't tell what that actually looks like in your schema — that said, not saying that you should post that, you simply will need to match the return shape of your mutation.

Also updateQuery here may be unnecessary and I'd start out first with something more minimal like cache.link, since most of the time, you'll only want to update links and relations that your mutation can't "see"

See: https://formidable.com/open-source/urql/docs/graphcache/cache-updates/#optimistic-updates
and: https://formidable.com/open-source/urql/docs/graphcache/cache-updates/#writing-links-individually

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@sagunji
Comment options

@kitten
Comment options

@sagunji
Comment options

Answer selected by sagunji
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