DEV Community

John Ding
John Ding

Posted on

update local cache after mutation(update/delete/insert)

update(cache, {data}) {
cache.modify({
id: cache.identify({
id: data.response.comment.answerId,
__typename: 'Answer',
}),
fields: {
commentCount(oldCount) {
return oldCount + 1
},
},
})
}

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more