This file contains 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
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