Skip to content

Instantly share code, notes, and snippets.

@gc-codesnippets
Created March 26, 2018 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gc-codesnippets/7449f5bc922f70cd08da3237d01cf7e3 to your computer and use it in GitHub Desktop.
Save gc-codesnippets/7449f5bc922f70cd08da3237d01cf7e3 to your computer and use it in GitHub Desktop.
<Mutation
mutation={CREATE_DRAFT_MUTATION}
update={(cache, { data }) => {
const { drafts } = cache.readQuery({ query: DRAFTS_QUERY })
cache.writeQuery({
query: DRAFTS_QUERY,
data: { drafts: drafts.concat([data.createDraft]) },
})
}}
>
... like before ...
</Mutation>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment