Add experimental support for @defer, @stream, and @live
See original GitHub issueI’ve just completed implementation of the three new directives mentioned in the GraphQL Futures talk in GraphQL-Go: https://gist.github.com/paralin/f6891bd30eb96e91fba628096af3278c
I now need to enable Apollo-Client to understand these responses.
- A “query” now has a stream of responses (like a subscription) and will need a new NetworkInterface type to enable this kind of streaming transport.
- The “query” ends when the remote server closes the result channel. It’s up to the network interface to understand when this happens and communicate it back to Apollo.
- Any query, even ones that do not use
@stream
,@defer
, or@live
can be sent over a streaming channel in the same way. If a query does not require returning data at a later time, the server will just immediately close the channel after returning the initial result. - Initial result looks identical to how Apollo currently receives results, with the exception of the lack of fields that are deferred in the initial response (those come in later)
- The field path looks like
["regions", 0, "status"]
and comes in inextensions.path
.
These features are obviously experimental, but I’ve been able to build a real proof of concept of the server end of this in just a couple of days. I’m interested to now get it working properly with Apollo.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:33 (15 by maintainers)
Top Results From Across the Web
New features in GraphQL: Batch, defer, stream, live, and ...
There is cool stuff to experiment with: I'm really excited to experiment with these features in Apollo. Since Apollo includes client and server ......
Read more >Defer and Stream Directives in GraphQL - YouTube
Defer and Stream Directives in GraphQL with Rob Richard, Sr Director, Front-End Engineering at 1stdibs, and Liliana Matos, Director, ...
Read more >Adding @defer and @stream to Absinthe - Elixir Forum
So I've got some use-cases that would be made much simpler if Absinthe supported the (not yet standardised) @defer and @stream directives ...
Read more >Improving Latency with @defer and @stream Directives
We have released experimental versions of GraphQL.js and express-graphql . They are published to npm under graphql@experimental-stream-defer ...
Read more >Experimental decorators warning in TypeScript compilation
I've to add the following in the settings.json file of vscode to remove the warning. "javascript.implicitProjectConfig.experimentalDecorators": true.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any progress on supporting
@defer
on apollo? 😄I think this is a good thing to reopen - part of the work for #1941 (Apollo Client 2.0) is supporting multiple results for the same query, which will make supporting
@live
and@defer
pretty easy!