Waiter not registered for some async calls
See original GitHub issueWhen we face this issue:
There are some scenarios when settled
does not wait for some async calls:
- when there is a watched query and we refetch the query;
- when there is a watched query and we fetch more data;
- when we send a mutation with the option
refetchQueries
;
We just increment the ongoing counter for the first fetch. When we call refetch
, fetchMore
or set refetchQueries
when sending a mutation, we do not register those ongoing requests.
How this is solved in my app
Query Manager
import QueryManager from 'ember-apollo-client/apollo/query-manager';
export default QueryManager.extend({
refetch(opts, observable) {
return this.apollo.refetch(opts, observable);
},
fetchMore(opts, observable) {
return this.apollo.fetchMore(opts, observable);
}
});
Service
import ApolloService from 'ember-apollo-client/services/apollo';
import QueryManager from 'my-app/apollo/query-manager';
export default ApolloService.extend({
createQueryManager() {
return QueryManager.create({ apollo: this });
},
refetch(opts, observable) {
return this._waitFor(observable.refetch(opts));
},
fetchMore(opts, observable) {
return this._waitFor(observable.fetchMore(opts));
},
mutate(opts, resultKey) {
if (Ember.testing) {
opts.awaitRefetchQueries = true;
}
return this._super(opts, resultKey);
}
});
Examples of how we use those functions:
fetchMore
for paginationrefetch
for searches- mutation with
refetchQueries
for deletes
Disclaimer
We are not mocking our API. Our API has a sandbox server for tests. Maybe mocks are obfuscating this issue.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:16 (10 by maintainers)
Top Results From Across the Web
Async End<Method> not called in WCF - Stack Overflow
I have the following situation: My WCF service allows a client to register to wait for some event. The waiting is asynchronous on...
Read more >Migrate to ember-test-waiters · Issue #297 · ember-graphql/ember ...
We have built our own solution for registering test waiters with ember, but we should take a look at ... Waiter not registered...
Read more >Synchronization Primitives — Python 3.11.1 documentation
methods of these synchronization primitives do not accept the timeout argument; use the asyncio.wait_for() function to perform operations with timeouts.
Read more >Concepts - Oracle Help Center
To make asynchronous calls, create an instance of the asynchronous client. ... A waiter can be invoked in both a blocking or a...
Read more >Async, Await, and ConfigureAwait – Oh My! | Core BTS Blog
If there is a possibility that a synchronous call could call your asynchronous method, you end up being forced to put .ConfigureAwait(false) on ......
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
@viniciussbs Your solution is working for me, thank you 😃
@bgentry Any input on this one?