Created
August 25, 2017 15:40
-
-
Save gc-codesnippets/3463869f00d48ae61c0903d3b0e55ae7 to your computer and use it in GitHub Desktop.
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
| 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