Open njwest opened 5 years ago
Apollo Cache management tip: always include a resource's ID field in any query/mutation return, the Apollo Cache appears to use resource IDs for automatic cache refreshing?
Apollo Cache management tip: always include a resource's ID field in any query/mutation return, the Apollo Cache appears to use resource IDs for automatic cache refreshing?
That is what I thought, but it doesn't seem to work automatically. Well at least as I expect, I'd think anywhere in my Vue app that has a smart query setup that is looking at an object with that ID would get updated automatically after a mutation somewhere else in the app. If that is not how it works, it would be good to have it explained somewhere for sure.
Also, knowing when "automatic" cahce updates happen after a mutation and when to use store.writeQuery({ query: TAGS_QUERY, data })
would be helpful. It seems like if we have IDs returned for everything we wouldn't need to writeQuery()
at all, but perhaps not.
It would be great to put together some documentation on caching in Apollo with vue-apollo, and I'd like to help on this front, but I am not sure of what Vue-targeted caching docs/examples are out there already
Some questions: