Skip to content

Instantly share code, notes, and snippets.

@gc-codesnippets
Created August 25, 2017 15:40
Show Gist options
  • Select an option

  • Save gc-codesnippets/3463869f00d48ae61c0903d3b0e55ae7 to your computer and use it in GitHub Desktop.

Select an option

Save gc-codesnippets/3463869f00d48ae61c0903d3b0e55ae7 to your computer and use it in GitHub Desktop.
updater: (proxyStore) => {
const deletePostField = proxyStore.getRootField('deletePost')
const deletedId = deletePostField.getValue('deletedId')
const viewerProxy = proxyStore.get(viewerId)
const connection = ConnectionHandler.getConnection(viewerProxy, 'ListPage_allPosts')
if (connection) {
ConnectionHandler.deleteNode(connection, deletedId)
}
},
optimisticUpdater: (proxyStore) => {
const viewerProxy = proxyStore.get(viewerId)
const connection = ConnectionHandler.getConnection(viewerProxy, 'ListPage_allPosts')
if (connection) {
ConnectionHandler.deleteNode(connection, postId)
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment