Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save gc-codesnippets/42dac6c6c5015830815e3bbe045bff7c to your computer and use it in GitHub Desktop.
import {
commitMutation,
graphql,
} from 'react-relay'
import {ConnectionHandler} from 'relay-runtime'
import environment from './Environment'
const mutation = graphql`
mutation DeletePostMutation($input: DeletePostInput!) {
deletePost(input: $input) {
deletedId
}
}
`
export default (postId, viewerId) => {
const variables = {
input: {
id: postId,
clientMutationId: ""
},
}
commitMutation(
environment,
{
mutation,
variables,
onError: err => console.error(err),
optimisticUpdater: (proxyStore) => {
// ... you'll implement this in a bit
},
updater: (proxyStore) => {
// ... this as well
},
},
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment