graphql-flutter
graphql-flutter copied to clipboard
Support @defer directive
Is your feature request related to a problem? Please describe.
Apollo Server has the @defer
directive, which returns a stream of partial data, building the response one piece at a time, deferring non-essential queries
Describe the solution you'd like
GraphQL Flutter should be able to handle @defer
directives seemlesly
Describe alternatives you've considered
Perhaps the result of query
could be a Stream
, in which data is publish as it comes in
Additional context https://www.apollographql.com/blog/introducing-defer-in-apollo-server-f6797c4e9d6e/
This is probably something we'll leave in the 3rd party link / "userland" world.
To go a bit more in-depth: if someone wrote a link that detected @defer
in the request, and handled merging and re-emitting updated responses as they were returned, then we could rework the code path for watchQuery
to be a stream that closes upon the final response with some indicative context of what paths are still deferred. However, this is all fairly involved.