Contentful logo

Contentful Community

How to update apollo graphql cache without graphql mutation

Hi,

I’m using the content delivery graphql API with React.

Since contentful doesn’t provide graphql mutations, I’m using the contentful-management SDK to update entries. The problem is that the apollo cache is not updated hence results stay the same.

Usually useMutation hook is very handy because it allows you to automatically update the graphql query. I’m forced to switch the fetchPolicy to “network-only” and I’m not able to take advantage of the apollo cache.

Is there a better way ?

Thanks