fetchPolicy: 'network-only' being ignored
See original GitHub issueI’m trying to use watchQuery with ‘netwok-only’ fetchPolicy and pollInterval, as a result the following output
Error: Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.
let options:any = {
query: gql `...`,
fetchPolicy: 'network-only',
};
this.feedRef = this.apollo.watchQuery(options);
console.log('queryRef: ', this.feedRef)
I have even put this mode in the default settings,
this.apollo.create({
link: middleware ? errorLink.concat(middleware) : errorLink.concat(this.link),
cache: this.cache,
ssrMode: true,
defaultOptions: {
watchQuery: {
fetchPolicy: 'network-only'
}
}
});
in the package.json …
"apollo-angular": "1.0.1",
"apollo-angular-link-http": "1.0.2-beta.0",
"apollo-cache-inmemory": "1.1.11",
"apollo-cache-persist": "0.1.1",
"apollo-client": "2.2.7",
"apollo-client-rxjs": "^0.6.0-rc.2",
"apollo-link": "1.2.1",
"apollo-link-context": "1.0.7",
"apollo-link-error": "1.0.7",
"apollo-link-http": "1.5.3",
"graphql": "0.13.2",
"graphql-tag": "2.8.0",
Anyone knows what I’m missing up? Thanks
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
fetchPolicy: 'network-only' being ignored · Issue #503 - GitHub
I'm trying to use watchQuery with 'netwok-only' fetchPolicy and pollInterval, as a result the following output Error: Queries that specify ...
Read more >Queries - Apollo GraphQL Docs
The useQuery React hook is the primary API for executing queries in an Apollo ... fetchPolicy: 'network-only', // Doesn't check cache before making...
Read more >Cache management for watchQuery (Angular-Apollo)
If not all data is available in the cache, an error will be thrown. This is equivalent to the former noFetch. { fetchPolicy:...
Read more >How to use the apollo-link.from function in apollo-link - Snyk
export default function createApolloClient() { // "apollo-link" is a standard ... cache }; const devtoolsLink = from([ errorLink(), cacheLink(fetchPolicy), ...
Read more >Understanding Apollo Fetch Policies | by Galen Corey - Medium
The default fetch policy for Apollo is cache-first. ... information from the cache, it may make sense to use a 'network-only' fetch policy....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Do you use SSR mode?
Try using setting the
ssrForceFetchDelay
option to a non-zero value, say500
. This should undo the forced “cache-only” policy as per this code: https://github.com/apollographql/apollo-client/blob/337314111bc75e17834d0dfb6af461b921276dd2/packages/apollo-client/src/ApolloClient.ts#L127-L132