-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Unmounting Query component no longer cancels network request in v2.6.0 & v3 beta #4955
Comments
I also have a somewhat unrelated question: is there any chance #2813 could get some love? I keep running into it when trying to implement pagination. The issue has existed for 1.5 years but nothing has been done yet |
Update: recently I've been creating my own ApolloLink, which led me to learn more about Observables and the ApolloClient API. When writing tests for my Link, I discovered that calling
I hope this information is helpful in debugging the problem |
@benjamn I updated my reproduction to use the new apollo-client v3 beta and the problem still exists (https://codesandbox.io/s/network-request-does-not-get-caneled-in-apollo-client-v3-beta-sckhn) By the way, I saw your presentation on the graphql summit livestream. Very excited to start using the new features of v3 |
It's been 8 month since this issue was opened... Is there anything we can do to help the team address it ? |
Apollo team doesn't care it seems. |
I must be doing something wrong because this is really bad. It will crash every time if the user navigates to a different page in my React app while there's a pending fetchMore. I'm not even sure it's only fetchMore. It would appear to be any long running query/mutation. Has this really always been there? Edit: As a side note, I found this workaround on a related issue and it at least cleans things up: |
We're experiencing the same problem on a React Native app using apollo-client Wrapping fetchMore with a try/catch block seems to be the only solution available at the moment. Is there any plan to fix this in apollo-client v3.0.0 before the final release? |
Just so you guys know, this issue is not about |
I end up having the following errors in tests because of this:
Is there a way to tell apollo to ignore the response if the component is unmounted (rather than actually cancelling the request) |
switched to using client.query() + useEffect with cleanup. Until better times. 😫 |
Still a problem in v3 rc12: https://codesandbox.io/s/network-request-does-not-get-caneled-in-apollo-client-v3-beta-sckhn |
I encountered same issue with basically, it's just a promise returned by hooks not being canceled before unmount. took me 2 hours trying to cancel the request... |
problem is gone after upgraded apollo-client 3.3.3 |
Using |
v3.3.7 still the same. Please fix this. |
Still an issue. Feels like if you build anything more complex that TODO list apollo client brings more problems and bugs than is solves. UPD: with client version 3.3.3 it's cancel requests. |
@asmyshlyaev177 it looks like it does not cancel them for me with |
Try version 3.3.3 and if everything works never update. |
Looks like requests are now getting properly canceled on unmount in the latest version (v3.3.15). Closing! 😄 |
Issue still open for me with 3.3.15 |
@dwome The problem as I described it was fixed, so this issue will remain closed. If you're still having problems, please create a runnable reproduction and open a new issue. Creating a runnable reproduction that shows the issue is the fastest way to get it resolved. |
Intended outcome:
When a Query component unmounts before the network request completes, the network request should be canceled. This worked in apollo-client 2.5.1.
Actual outcome:
In v2.6.x, unmounting a Query component before the network request completes does not cancel the request.
How to reproduce the issue:
Example of the network request correctly being cancelled with apollo-client v2.5.1: https://codesandbox.io/s/4vt2f
Example of the network request not being cancelled with apollo-client v2.6.2:
https://codesandbox.io/s/0yo3f
The only difference between these two examples is the apollo-client package (v2.5.1/v2.6.2)
Versions
apollo-cache-inmemory: 1.6.0
apollo-client: 2.6.2
apollo-link: 1.2.11
apollo-link-http: 1.5.14
react-apollo: 2.5.6
Thank you! :) I'm loving Apollo Client so far
The text was updated successfully, but these errors were encountered: