Can't use await in update method of apollo mutation

Viewed 212

I'm trying to update cache to trigger rerender of UI but it seems that the update method on apollo mutations does not work correctly if you use async/await

mutation({
  variables: {
    ...
  },
  update: async (cache, responseFromMutation) => {
    ...
    const someFunctionResult = await someFunction()
    proxy.writeQuery({...}) // this writes to cache but doesn't trigger rerendering of UI. If we take out the `await` it works.
  }
})

Any ideas?

0 Answers
Related