diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-30 18:09:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-30 18:09:15 +0300 |
commit | 536aa3a1f4b96abc4ca34489bf2cbe503afcded7 (patch) | |
tree | 88d08f7dfa29a32d6526773c4fe0fefd9f2bc7d1 /app/assets/javascripts/lib | |
parent | 50ae4065530c4eafbeb7c5ff2c462c48c02947ca (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/graphql.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/graphql.js b/app/assets/javascripts/lib/graphql.js index 2c5278d16ae..b49fe9362c2 100644 --- a/app/assets/javascripts/lib/graphql.js +++ b/app/assets/javascripts/lib/graphql.js @@ -5,6 +5,14 @@ import { ApolloLink } from 'apollo-link'; import { BatchHttpLink } from 'apollo-link-batch-http'; import csrf from '~/lib/utils/csrf'; +export const fetchPolicies = { + CACHE_FIRST: 'cache-first', + CACHE_AND_NETWORK: 'cache-and-network', + NETWORK_ONLY: 'network-only', + NO_CACHE: 'no-cache', + CACHE_ONLY: 'cache-only', +}; + export default (resolvers = {}, config = {}) => { let uri = `${gon.relative_url_root}/api/graphql`; @@ -32,5 +40,10 @@ export default (resolvers = {}, config = {}) => { }), resolvers, assumeImmutableResults: config.assumeImmutableResults, + defaultOptions: { + query: { + fetchPolicy: config.fetchPolicy || fetchPolicies.CACHE_FIRST, + }, + }, }); }; |