-
Can you please help me with the following scenario? I want to add a new annotation node optimistically to the 'hydratedJourneyCanvas' with the ID 'da9dad54-a817-4e56-95f4-97ce2b38ba3f'. Here is my configuration for the optimistic cache and mutation update:
The structure of the cache related to the 'hydratedJourneyCanvas' is as follows:
Could you guide me on how to add a new annotation node optimistically to the 'annotationNodes' field of 'hydratedJourneyCanvas'? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Also See: https://formidable.com/open-source/urql/docs/graphcache/cache-updates/#optimistic-updates |
Beta Was this translation helpful? Give feedback.
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 likecache.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