I am using React Apollo GraphQL named mutation to invoke the mutation with the specific name just because I have multiple mutations in the same component. When I am using options.update to update the cache, the update isn't invoked.
My multiple mutation code goes like this:
export default
compose(
graphql(
SaveRuleMutation,
{
name: 'SaveRule',
options: {
update: (proxy, data) => {
//Not getting invoked
}
}
}
), graphql( UpdateRuleMutation, { name: 'UpdateRule', } ) )(Panel);
Below is my mutation call:
SaveRule({
variables: {
name: values.name,
panelId: panelId,
where: values.where,
sort: values.sort
},
optimisticResponse: {
panelView:{
__typename: 'PanelViewMutation',
}
__typename: 'PanelView',
create: {
id: -1,
name: values.name,
panelId: panelId,
where: values.where,
sort: values.sort
},
},
})
.then(function(ruleObj){
console.log('ruleObj', ruleObj)
})
.catch(function(error){
console.log('error', error)
})