From 59669f23e73eb1973993d67c18761ced0e6a482b Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 04:15:17 +0100 Subject: [PATCH] Setting "cache-and-network" as default fetch policy --- client/src/graphql/apollo.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/src/graphql/apollo.js b/client/src/graphql/apollo.js index cbe378fba..006367f4d 100644 --- a/client/src/graphql/apollo.js +++ b/client/src/graphql/apollo.js @@ -73,8 +73,23 @@ const authLink = setContext((_, { headers }) => { const cache = new InMemoryCache().restore(window.__APOLLO_STATE__) +const defaultOptions = { + watchQuery: { + fetchPolicy: 'cache-and-network', + errorPolicy: 'all' + }, + query: { + fetchPolicy: 'cache-and-network', + errorPolicy: 'all' + }, + mutate: { + errorPolicy: 'all' + } +} + export const client = new ApolloClient({ link: ApolloLink.from([authRetryLink, authLink, httpLink]), // replaced link with httpLink cache, + defaultOptions, connectToDevTools: true })