I'm using apollo angular client with the InMemoryCache. I have some watchQuery's for which I want to disable caching. I've setup my client as follows:
link: httpLink.create({uri}),
cache: new InMemoryCache(),
ssrMode: false,
ssrForceFetchDelay:0,
defaultOptions: {
watchQuery: {
fetchPolicy: 'no-cache',
errorPolicy: 'ignore',
},
query: {
fetchPolicy: 'no-cache',
errorPolicy: 'all',
},
}
and my watchQuery looks like this:
return this.apollo.watchQuery<TestAssetListQuery>({
query: gql`
query {
testAssetList {
name,
path,
size
}
}
`,
fetchPolicy: "no-cache",
}).valueChanges;
Yet, every subsequent query is pulled from cache.
I'd appreciate any advice on how to force apollo not to cache my queries.
Since I have not enough reputation to comment. I will try to post it.
Try using network-only
instead of no-cache
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With