Skip to content
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

Consecutive calls execution from useLazyQuery hook doesn't longer cancel previous calls in pending #9141

Closed
Grmiade opened this issue Nov 30, 2021 · 4 comments

Comments

@Grmiade
Copy link

Grmiade commented Nov 30, 2021

Intended outcome:
When we made consecutive calls (with different variables) with the executionFunction from useLazyQuery hook, we are expecting the previous calls still in pending are canceled.
We had this behavior with @apollo/client@3.4.17 by using the built-in HttpLink.

Actual outcome:
With @apollo/client@3.5.5, the previous calls in pending are not longer cancelled.

How to reproduce the issue:
https://codesandbox.io/s/apollo-client-3-5-5-uselazyquery-cancellation-tp7ld?file=/package.json

  • Make your network slow, with the "Slow 3G" option on Chrome by example.
  • Click several times on Get Countries button

Versions
@apollo/client@3.5.5

@benjamn
Copy link
Member

benjamn commented Dec 1, 2021

@Grmiade Thanks for the repro!

@hwillson hwillson added 2022-01 and removed 2021-12 labels Jan 3, 2022
@hwillson hwillson assigned brainkim and unassigned benjamn Jan 20, 2022
@hwillson hwillson added the 🔍 investigate Investigate further label May 31, 2022
@jpvajda jpvajda self-assigned this Jun 6, 2022
@jpvajda
Copy link
Contributor

jpvajda commented Jun 6, 2022

@Grmiade Thanks for reporting this, I was curious if you could confirm the following:

  1. Have you tried upgrading to the current version of Apollo Client? We are currently at 3.6.5
  2. Your sample code seems to use math.random to generate multiple codes, but that doesn't seem to be working in the sample, could you provide a better example of what you are using to generate different country code variables or provide a sample that has a set of codes you are attempting to query at the same time so we can further troubleshoot this issue?

We are happy to take a look at this issue again as it's been a while since it was reported.

@Grmiade
Copy link
Author

Grmiade commented Jun 14, 2022

Hi @jpvajda 👋
The math.random trick does not seem to work anymore indeed. I used a random API, maybe they changed their behaviour. But it's not a problem, the issue is still here when we make consecutive pending calls.

Good news, I made some tests and since the version 3.6.8, it seems the issue is fixed. Probably thanks to #9791

@jpvajda
Copy link
Contributor

jpvajda commented Jun 15, 2022

@Grmiade great to hear! Thanks for letting us know. I'll close this issue out.

@jpvajda jpvajda closed this as completed Jun 15, 2022
@jpvajda jpvajda removed the 🔍 investigate Investigate further label Jun 15, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants