Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
onUpdate = (cache, { data: { createBoard } }) => {
const { myBoards } = cache.readQuery({ query: MYBOARDS_QUERY });
cache.writeQuery({
query: MYBOARDS_QUERY,
data: { myBoards: myBoards.concat([createBoard]) }
});
this.handleCancel();
};
...
<Mutation mutation={CREATE_BOARD_MUTATION} update={this.onUpdate}>
{(createBoardMutation, { loading, error }) => (
<Search
placeholder="e.g. ACME Ping Pong"
enterButton={
<Button type="primary" loading={loading}>
Create!
</Button>
}
size="large"
onSearch={value => {
createBoardMutation({ variables: { name: value } });
}}
/>
)}
</Mutation>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.