-
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
keep deferred inFlightLinkObservables until the response is finished #12338
keep deferred inFlightLinkObservables until the response is finished #12338
Conversation
🦋 Changeset detectedLatest commit: b201bc0 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 |
|
commit: |
✅ Deploy Preview for apollo-client-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
size-limit report 📦
|
I have verified over in apollographql/apollo-client-nextjs#424 that this is exactly what this needs. Gonna polish this PR, add a few tests and then we should get this into 3.13. |
b0183ec
to
b201bc0
Compare
Added a test, this should be ready for review. |
concast.beforeNext(function cb(method, arg: FetchResult) { | ||
if (method === "next" && "hasNext" in arg && arg.hasNext) { | ||
concast.beforeNext(cb); | ||
} else { | ||
inFlightLinkObservables.remove(printedServerQuery, varJson); | ||
} |
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.
Note that this change right now applies to @defer
etc., but not to subscriptions.
Changing that for subscriptions would be nice, but feels a bit more breaking, so I think we should probably do that in 4.0 - WDYT @jerelmiller ?
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.
That makes sense to me. I see no reason why two subscriptions kicked off with the same document/variables shouldn't be deduped, especially since it can be disabled per-subscription if need be. Mind making a tracking issue and putting it in the milestone so that we don't forget to update?
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.
#12348 👍
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.
Fantastic test addition that demonstrates all the things I was hoping to see. Thanks for getting this done!
We're getting to a point where we have all the tools in place that writing these tests is actually fun :) |
An experiment. This might be required for query streaming with
@defer
anduseSuspenseQuery
.