Incremental Delivery🔗
Note that incremental delivery is currently experimental and may change in the future.
Undine has experimental support for incremental delivery of data
using the @defer and @stream directives. To enable incremental delivery,
all of the following must be true:
graphql-coreversion must be3.3.0a12(note alpha version, later versions might not work)EXPERIMENTAL_INCREMENTAL_DELIVERYmust be set toTrue- Async support must be enabled
Let's look at an example of incremental delivery using the @defer and @stream directives.
Given the following schema:
If we wanted to query the "slow" field, the client would need to wait for five seconds for the server to resolve it before it can show any of the other data.
However, using the @defer directive, the client can receive the rest of the data immediately and
the deferred data when its complete. The @defer directive works on fragment spreads an inline fragments.
Similarly, if we wanted to query the "countdown" field, the client would need to wait for ten seconds for the entire countdown to end before it can show any of the other data.
However, using the @stream directive, the client can receive the rest of the data immediately
and stream in each countdown result as they become available. The @stream directive works on list fields.