Hi,
I'm having an issue using pollInterval with watchQuery, this initial query is returned but subsequent requests are not made.
Relevant pieces from package.json
"apollo-angular": "0.13.1",
"apollo-client": "^1.9.1",
"apollo-client-rxjs": "^0.6.0-rc.1",
"graphql": "^0.11.2",
"graphql-tag": "^2.4.2",
This is my code;
this.apollo.watchQuery<any>({
query: queryName,
pollInterval: 1000,
variables: {
name: 'testing',
},
}).subscribe((res: ApolloQueryResult<any>) => {
console.log('Got Data', res);
}, (err: any) => {
console.log('Error loading data');
});
Thanks,
David
it is working i think, but you have to keep in mind, that your callback is only executed if there are any changes in the cache/response object.
I had the same misleading idea how this works.
cache-first (if the value is in cache --> no requests are made) to e.g. network-only or cache-and-networknetwork-only --> requests are made in the specified polling interval, but your callback is only executed if the response value changes. ;)Please create a reproduction on stackblitz.io or similar.
Here's a template: https://stackblitz.com/edit/simple-apollo-angular-example
Most helpful comment
it is working i think, but you have to keep in mind, that your callback is only executed if there are any changes in the cache/response object.
I had the same misleading idea how this works.
cache-first(if the value is in cache --> no requests are made) to e.g.network-onlyorcache-and-networknetwork-only--> requests are made in the specified polling interval, but your callback is only executed if the response value changes. ;)