⬡ GraphQL Advanced

What is incremental delivery in GraphQL with @defer and @stream?

Answer

Incremental delivery is a GraphQL feature that allows the server to send parts of a response progressively as they become ready, rather than waiting for the entire response. The @defer directive marks a fragment that can be delivered later: { user { name ... on User @defer { expensiveComputedField } } }. The client receives an initial response with the non-deferred fields immediately, then receives patches for deferred fragments over a multipart HTTP response. @stream applies to list fields, streaming list items as they are resolved. This dramatically improves perceived performance — users see critical data (like a page title) instantly while slower data loads in the background. Both are part of the GraphQL 2022 specification and require server and client support (Apollo Server 4+ and Apollo Client 3.7+).