Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const onUpdate = (key) => (value) => {
const task = { [key]: value };
updateTask({
variables: { task, id },
update: (proxy, { data = {} }) => {
// update cache with local values
proxy.writeData({ id: `Task:${id}`, data: task });
// or update cache with the values coming from the server,
// for example if you need to reflect the updated timestamp
const { updateTask } = data;
proxy.writeData({ id: `Task:${id}`, data: updateTask });
},
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment