Mutation serial execution with defer & stream #1
robrichard
announced in
Architectural Decision Records
Replies: 1 comment 1 reply
-
Discussed in the 2021-12-02 WG meeting:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context
The GraphQL spec states that the selection set of mutations must be executed serially. How should
@defer
and@stream
interact with GraphQL operations that contain multiple GraphQL mutations?Example
Without
@defer
, the GraphQL spec currently guarantees that resultA will be resolved before mutationB is executed.The two options being considered are
Option 1. All asynchronous payloads from each mutation must be sent before the next mutation is executed. This means
@defer
and@stream
directives are ignored on all but the last mutation in the operation, or are buffered until after the subsequent mutations are completed and the initial payload is sentOption 2. The next mutation begins executing after all synchronous fields are executed. Deferred and streamed fields from early mutations could potentially be executed after later mutations are executed.
Consequences
Decisions
@defer
/@stream
in a mutation sends a signal that consumers are opting into the possibility that subsequent mutations may be executed before the deferred/streamed field from prior mutations are executed.Status
Currently option 2 is implemented in graphql-js and spec. Additional explanatory text has been added to
Execution - Normal and Serial Execution
spec.Related
Beta Was this translation helpful? Give feedback.
All reactions