Disable Apollo cache on the cases where Apollo Client is used within Vuex

Summary

So far, at GitLab there are some cases where Apollo Client is used for Promise-based queries and mutations performed via Vuex actions. The result is stored to Vuex store, so there is no sense having the client cache enabled: it means currently we're storing data in two places.

More to say, a subsequent fetch, in this case, will give us a result from Apollo Cache, not from the actual API.

Improvements

We need to make createGqlClient util to be able to take an options parameter to set a default fetch-policy for queries. An alternative solution would be passing fetch-policy directly to queries called from Vuex.

Additionally, we need to improve the documentation on this.

Risks

There is a slight risk that during the migration from Vuex to Apollo we forget to remove fetch-policy: no-cache. There are no other significant risks I can think of.

Involved components

  • ee/app/assets/javascripts/epic
  • ee/app/assets/javascripts/related_items_tree
  • ee/app/assets/javascripts/roadmap
  • app/assets/javascripts/monitoring
Edited by Natalia Tepluhina