如何为我的react应用程序设置全局默认fetchPolicy?我希望缓存和网络成为我的默认设置。我试过了:
const client = new ApolloClient({
cache,
link: headerResponseReader.concat(link),
defaultOptions: { query: { fetchPolicy: "cache-and-network" } }
});但它不起作用。
发布于 2019-08-13 15:12:24
For the time being您必须设置所有三种类型。
const defaultOptions = {
watchQuery: {
fetchPolicy: 'cache-and-network',
errorPolicy: 'ignore',
},
query: {
fetchPolicy: 'cache-and-network',
errorPolicy: 'all',
},
mutate: {
errorPolicy: 'all'
}
}
const client = new ApolloClient({
link,
cache,
defaultOptions,
})https://stackoverflow.com/questions/51920420
复制相似问题