-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Waiter not registered for some async calls #192
Comments
It looks like you passing a promise to |
I will provide some context. |
@tchak where did you saw the signature of |
Hmm, you right, sorry. I am not sure why your implementation is not working then. |
@tchak the issue is that Sorry if the description is not so clear. |
Ah, cool! Sorry, I was confused because of the cross post in the |
@bgentry Any input on this one? |
@josemarluedke Are you the new maintainer? Do you need with this issue? |
@viniciussbs Yes, I'm helping maintain this project. Are you still having this issue? If so, could you create a pull request with a failing test? Or create a reproduction repo. I also was looking forward to migrating to |
@josemarluedke I'm not facing this issue because I'm using the solution I've posted here. But, yes, the problem still exists. This is not a bug, it's just a case of "not supported feature" of Apollo Client. Apollo Client give us I'll try to send you a pull request with the failing test or create a reproduction repo. |
I'm trying to get a reproduction of this issue and unfortunately, I'm not able to do so. I have created a test for the refetch case and it works fine in our test suite. Could it be due to Ember versions? What version are you using? A side note, I actually removed the code for the test waiters and all our tests still passes. I will add some tests to specifically make sure we have coverage for this. |
@josemarluedke We are using Ember 3.7. I don't think it's related to the version, though.
Maybe that's it. Those tests use a mocked API, I guess. Ours hit a "sandbox API" - for a lot of reasons, we decided not to mock our API. Maybe you don't have failures because the mocked API responds right away? 🤔 |
For what it's worth, I was using a sandbox API as well when I also encountered this issue. That's probably it. |
@xtagon Could you try the solution that I've posted? It seems to work here. |
@viniciussbs Your solution is working for me, thank you :) |
For reference, you can now do this pretty easily yourself using import { waitForPromise } from '@ember/test-waiters';
export default MyComponent extends Component {
fetchMore() {
return waitForPromise(this.apollo.fetchMore(...))
}
} |
When we face this issue:
There are some scenarios when
settled
does not wait for some async calls:refetchQueries
;We just increment the ongoing counter for the first fetch. When we call
refetch
,fetchMore
or setrefetchQueries
when sending a mutation, we do not register those ongoing requests.How this is solved in my app
Query Manager
Service
Examples of how we use those functions:
fetchMore
for paginationrefetch
for searchesrefetchQueries
for deletesDisclaimer
We are not mocking our API. Our API has a sandbox server for tests. Maybe mocks are obfuscating this issue.
The text was updated successfully, but these errors were encountered: