Disable Apollo cache if Apollo Client is used within Vuex

What does this MR do?

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 in the 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

Does this MR meet the acceptance criteria?

Conformity

Closes #198624 (closed)

Edited by Dhiraj Bodicherla

Merge request reports

Loading