-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[RFC] Alternative proposal for @stream
/@defer
#1018
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
robrichard
force-pushed
the
benjie/incremental2
branch
from
March 15, 2023 17:24
1b56d86
to
df84d1b
Compare
This PR is out of date versus what is currently being proposed. Closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This RFC is an alternative solution to incremental delivery. This is a very early draft to enable sharing this solution with the incremental delivery working group, and, if ratified, may either be merged into @robrichard et al's excellent work in #742, or supersede it.
This PR currently only addresses the algorithms in the execution part of the specification (and is based off of a recent draft of the GraphQL specification, rather than any preceding work), so for accompanying specification text regarding the syntax and directives of incremental delivery, please see the excellent prior work in #742.
The goal of this proposal is to address the needs of incremental delivery whilst:
@stream
and@defer
directives from the request.@defer
'd or@stream
'd selection set are sent atomically in a single event, such thatMyFragment: __typename
and other fragment identification approaches can be relied upon to confirm that the entire fragment is present.Non-goals of this proposal are:
@stream
or@defer
directives issued in the request.@stream
/@defer
directives in the request and any components in the response.@defer
s... @defer { ... @defer { a } }
is equivalent to... @defer { a }
, but we might change this.The significant change in this RFC is that it is built around the field merging algorithm that we already have, and allows merging
@defer
s not just within a single selection set, but across the entire request. It works based on "defer layers" - thus for a query such as:The first query to be resolved is as before:
Yielding something like:
Next the first layer of
@defer
'd leaves is evaluated, which results in the following selection sets being evaluated at the following paths:[]
, selection:{ h }
['a']
, selection:{ c { c1 } }
['a', 'd']
, selection:{ f }
All three of these are evaluated (separately, in parallel) and then grouped together into the same event, something like:
Finally we look at the next layer of
@defer
, which would yield:['a', 'c']
, selection:{ c2 }
Which would yield:
and finally:
(Note: we can probably optimize this to put the
hasNext: false
in the previous payload instead, but I've not yet tried to write that into the spec text.)