I want to change the default fetch policy for all my queries - how is this possible?
https://github.com/Akryum/vue-apollo#special-options you can use all this variables https://github.com/Akryum/vue-apollo/blob/next/src/consts.js
const apolloProvider = new VueApollo({
defaultClient: apolloClient,
defaultOptions: {
// apollo options applied to all components that are using apollo
$fetchPolicy: 'cache-and-network',
},
})
In Vue Apollo 2.x it seems like you have to define this on ApolloClient directly:
const apolloClient = new ApolloClient({
link: httpLink,
// link: batchHttpLink,
cache: new InMemoryCache(),
connectToDevTools: true,
defaultOptions: {
watchQuery: {
fetchPolicy: 'cache-and-network'
},
query: {
fetchPolicy: 'network-only'
}
}
})
Most helpful comment
In Vue Apollo 2.x it seems like you have to define this on ApolloClient directly: