I’m currently using cache.watches.values().next().value to get the current query variables for cache interactions, e.g:
export const useUpdateProject = () => {
const [updateProjectMutation] = useMutation(UPDATE_PROJECT, {
update: (cache, { data: { updateProject } }) => {
const { variables } = cache.watches.values().next().value
cache.writeQuery({
query: GET_PROJECT,
variables,
data: { project: updateProject }
})
}
})
return updateProjectMutation
}
…but maybe there’s a neater way to do this?