Skip to content

Instantly share code, notes, and snippets.

@seandearnaley
Last active February 21, 2020 07:10
Show Gist options
  • Save seandearnaley/ec8bfe66264efe4b77ceb708732a326d to your computer and use it in GitHub Desktop.
Save seandearnaley/ec8bfe66264efe4b77ceb708732a326d to your computer and use it in GitHub Desktop.
Cache Modify Example
update: cache => {
cache.modify('ROOT_QUERY', {
categories(categories: Reference[], { readField }) {
return categories.filter(
category => id !== readField('id', category),
);
},
});
// evict this item from the in memory cache
// note: this will not broadcast changes to cached queries on it's own.
cache.evict(`Category:${id}`);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment