-
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
Fix issue where a network request is made when using skip
/skipToken
with useSuspenseQuery
in strict mode
#11769
Conversation
🦋 Changeset detectedLatest commit: 8bbde98 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
|
||
try { | ||
if (originalFetchPolicy !== "no-cache") { | ||
if (avoidNetworkRequests) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I swapped the order of these if
statements as the positive connotation is always easier for my brain to comprehend when there is an else
included
✅ Deploy Preview for apollo-client-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for apollo-client-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
8bbde98
to
e6a63da
Compare
e6a63da
to
8bbde98
Compare
Fixes #11768
#11738 made it possible to dispose of the queryRef synchronously in our suspense hooks which released in 3.9.10. Unfortunately this caused a regression with strict mode where a network request was actually made. This change ensures that
standby
is properly handled in the queryRefreinitialize
function.NOTE: This only seemed to affect
useSuspenseQuery
. I've added tests foruseBackgroundQuery
as well to ensure we don't have future regressions, but the bug didn't seem to exhibit itself in this hook.