Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support @defer and @stream #734

Open
Type1J opened this issue Aug 11, 2020 · 2 comments
Open

Support @defer and @stream #734

Type1J opened this issue Aug 11, 2020 · 2 comments
Labels
enhancement Improvement of existing features or bugfix help wanted

Comments

@Type1J
Copy link

Type1J commented Aug 11, 2020

Is your feature request related to a problem? Please describe.
I'd like to issue 1 request and get back important data, but then have the less important data sent later, or have some parts streamed as they change (like a "like" count).

Describe the solution you'd like
The GraphQL spec is being updated to describe 2 directives: @defer and @stream that were made exactly to solve the problem as described above: graphql/graphql-spec#742 This is different from subscriptions, and it can use http 1.1 chunked encoding without websockets to accomplish this goal as described here: https://youtu.be/icv_Pq06aOY?t=788

Describe alternatives you've considered
Subscriptions are an alternative, however, that requires a second request.

Additional context
These ideas have been around for a long time: https://www.apollographql.com/blog/new-features-in-graphql-batch-defer-stream-live-and-subscribe-7585d0c28b07/

@Type1J Type1J added the enhancement Improvement of existing features or bugfix label Aug 11, 2020
@zaksabeast
Copy link
Contributor

Related to the implementation of @defer and @stream, it looks like @skip and @include have inlined logic at the moment, and I'm curious if there are any thoughts around having a way to provide resolvers for directives.

This could bring a few benefits:

  • An established method to add new directives (which would make it easier to add future directives, including @defer and @stream)
  • Specific location(s) for directive resolvers to live (if desired)
  • A way to add custom directives in the future

@dyedgreen
Copy link
Contributor

An easy way to declare custom directives on types would be really helpful! I was looking into a way to implement @fetchable for some object, and I don't believe there is currently a way to add custom directives at the type level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix help wanted
Projects
None yet
Development

No branches or pull requests

4 participants