Created
March 5, 2020 02:23
-
-
Save seandearnaley/15f9424957be030e51c24b341a3eb100 to your computer and use it in GitHub Desktop.
Remove Card Snippet for Connection
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
cache.modify(`Category:${categoryId}`, { | |
cards(cards: Reference, { readField }) { | |
const edges = readField<CardEdgeWithReference[]>('edges', cards).filter( | |
edge => edge.node.__ref !== `Card:${cardId}`, | |
); | |
let { totalCount } = readField<PageInfo>('pageInfo', cards); | |
const pageInfo = buildPageInfo<Edge<Card>>(edges, --totalCount, 'Card'); // rebuild pageinfo | |
return { | |
edges, | |
pageInfo, | |
}; | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment