-
-
Notifications
You must be signed in to change notification settings - Fork 800
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
upgrade executor to non-duplicating incremental delivery format #6243
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 5ddff7c The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
✅ Benchmark Results
|
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-tools/delegate |
10.0.13-alpha-20240702193839-5ddff7cfe353771d7175304a6feefa2c8b073e6c |
npm ↗︎ unpkg ↗︎ |
@graphql-tools/executor |
2.0.0-alpha-20240702193839-5ddff7cfe353771d7175304a6feefa2c8b073e6c |
npm ↗︎ unpkg ↗︎ |
@graphql-tools/stitch |
9.2.11-alpha-20240702193839-5ddff7cfe353771d7175304a6feefa2c8b073e6c |
npm ↗︎ unpkg ↗︎ |
@graphql-tools/utils |
10.3.0-alpha-20240702193839-5ddff7cfe353771d7175304a6feefa2c8b073e6c |
npm ↗︎ unpkg ↗︎ |
💻 Website PreviewThe latest changes are available as preview in: https://5804df8e.graphql-tools.pages.dev |
Some additional issues:
|
For changeset, you can run |
We can use the approach from graphql/graphql-js#4043 which improves code readability and includes a significant performance benefit. At graphql-js, we have not yet adopted this approach, because we will be following the spec more closely, at least during the initial adoption period. |
I forgot to mention that another BREAKING CHANGE is that incremental delivery no longer is supported within subscriptions. In theory, we can remote |
I've updated this PR to re-enable early execution by default. |
Is it possible that we would want this executor to emit the old duplicated format by default and enable the new format under a flag? |
I believe I've fixed the issue with aborting from incremental delivery despite pending long-running promises, still avoiding the use of The key was to realize that the I've added a test demonstrating this. |
I've added the new unit tests for |
Thinking about this more, this is definitely possible in terms of functionality, but there would be a breaking change in terms of the types -- or we would have to introduce a new set of types for the new format with maybe a prefix or suffix. I am not unsure how to proceed, definitely easier just to make it a BREAKING CHANGE, so at this point I will leave this PR as is => From my perspective, this is now ready for review! 🚀 |
6d3be83
to
06a5da9
Compare
8f272eb
to
1a42467
Compare
@yaacovCR Now catching up with your work and rewatching your video from GraphQL Conf was very helpful! 🙏 I am fine with shipping this as a breaking change. But, we should have a middleware/wrapper function that takes the execute function and emits the old format. That way we can at least provide people with a migration path within Yoga that can not upgrade all their client's code immediately! |
Sounds good, I can work on that. |
b50b1dd
to
bb5dfbf
Compare
I added an argument to toggle whether incremental is disabled for subscriptions so that should cover that breaking change. I'm trying to decide whether to add an argument for deduplication or whether to add a wrapper, I'm thinking of going with the former. As an aside, I think tests are broken separate from this PR. |
I left a few comments. And some of them would probably fix the type checking issues. |
I ran yarn upgrade and I got my local tests passing, too, that's what threw me off :) oneOf got backported to the executor, but I hadn't upgraded graphql locally :( |
Description
GraphQL Incremental Delivery is moving to a new response format without duplication.
This PR updates the executor within graphql-tools to follow the new format, with my best effort to integrate the changes made within the graphql-tools executor, largely around abortion.
Notes:
mergeIncrementalResults()
), and Yoga tests that rely on it pass,but there should probably eventually be new unit testsnew unit tests have been added within the existingmergeIncrementalResults()
tests. The function still work with the old response format.ids
and be required to lookup the path based on the information frompending
.This version is a straight-copy fromSome believe that despite theoretical causes for concern, a better default would be to enable early execution. This version enables early execution by default, with a flag to disable, differing from graphql-js where early execution will probably be disabled by default, at least initially.graphql-js
where a decision has been made to disable early execution by default.although this may mean that abortion might get stuck while waiting for the next payload if the underlying iterator does not properly handle a. The rationale for avoidingreturn()
Promise.race
is the memory leak that may occur with long-running promises.This change should probably be discussed further before merging.See the comment below for how this is accomplished.Type of change
Please delete options that are not relevant.
expected)
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can
reproduce. Please also list any relevant details for your test configuration
Test Environment:
@graphql-tools/...
: latestChecklist:
CONTRIBUTING doc and the
style guidelines of this project