Feat: Add Support for @defer
Directive with Incremental Delivery
#3156
Labels
state: inactive
No current action needed/possible; issue fixed, out of scope, or superseded.
We need to support defer capability which is suggested in the spec here
https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md
When the server recieves a defer directive on a fragment IO call to resolve that fragment should happen but for sending the initial response tailcall should not wait for the result of the that IO call and send the other results based on the spec.
Its possible that due to query planning that deferred call could move up as there was no dependency, even in that case even if this fragment IO succeeds before the other required IOs or fragment IO is cached still The spec should be followed and result should be sent in subsequent payloads.
Should work on both HTTP1 and HTTP2
For GraphQL communications built on top of HTTP, a natural and compatible technology to leverage is HTTP chunked encoding to implement a stream of responses for incremental delivery.
If client cancels the request before the deferred IO is completed the IO should be cancelled in that case
Description:
Implement support for the
@defer
directive in accordance with the [GraphQL Defer Stream RFC](https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md). This feature allows servers to deliver GraphQL responses incrementally by deferring the resolution of certain fragments.Requirements:
Deferred Fragment Resolution:
@defer
directive, the resolution of the deferred fragment should occur asynchronously.@defer
should be resolved and included in the initial payload.Compliance with Query Planning:
Streaming via HTTP:
Client-Driven Cancellation:
Example:
Query:
Server Behavior:
id
andname
fields of theuser
.profile
fragment, sent as a subsequent response.Implementation Notes:
<>TODO<>
The text was updated successfully, but these errors were encountered: