-
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
Queries cancelled in strict mode with nextFetchPolicy: "cache-first" #9989
Comments
Also facing this, which makes StrictMode impossible to use 😞 I see there is a reproduction, has work on this been planned? Thanks in advance and have a great day! |
Hello @hwillson, could you please take a look at this and point us in the right direction? Thanks a lot 🙏 |
@benjamn @jerelmiller is this something you could take a look at? The reproduction is short and sweet (and it still reproduces on 3.7.10) |
Hmm, that said, it does not reproduce using the alpha (currently Using the alpha in my own project also resolves the issue. |
Yeah, I would presume that this was fixed with #10629. I wanted to create you a PR build to test it, but it seems that the GitHub action is broken right now. Either way, we will probably release a new version within the next few days, and this should be included there. |
Ah, got it to build with a tip from @alessbell.
|
@phryneas yeah, can confirm installing that version specifically also fixes our tests 👍 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Intended outcome:
useQuery
withfetchPolicy: "network-only"
orfetchPolicy: "cache-and-network"
, andnextFetchPolicy: "cache-first"
.Actual outcome:
In step 4, the query happens, but is immediately cancelled. So, a query with a given set of variables will only be made once, and can never be made again. This only happens in React strict mode, the behavior is as-expected with React strict mode off.
How to reproduce the issue:
https://codesandbox.io/s/distracted-babbage-ry92hc?file=/src/index.jsx
Toggle mount/unmount with strict mode on, observe cancelled queries. With strict mode off, queries are not cancelled.
Versions
System:
OS: Linux 4.14 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
Binaries:
Node: 16.15.0 - /usr/bin/node
Yarn: 1.22.18 - /usr/bin/yarn
npm: 8.5.5 - /usr/bin/npm
npmPackages:
@apollo/client: ^3.6.9 => 3.6.9
The text was updated successfully, but these errors were encountered: