Last active
February 21, 2020 07:10
-
-
Save seandearnaley/ec8bfe66264efe4b77ceb708732a326d to your computer and use it in GitHub Desktop.
Cache Modify Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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