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

add support for @defer and @stream directives #3892

Closed
MarkLyck opened this issue May 1, 2022 · 1 comment
Closed

add support for @defer and @stream directives #3892

MarkLyck opened this issue May 1, 2022 · 1 comment

Comments

@MarkLyck
Copy link
Contributor

MarkLyck commented May 1, 2022

Is your feature request related to a problem? Please describe.

GraphQL mesh is a fantastic tool for combining multiple datasources. But not all datasources can generate a response in a reasonable time.

If I want to query data from let's say 4 different sources in 1 query, and 3 of the data sources all fetch the data within 200ms. But one Data source takes 4 seconds to fetch, I'm stuck waiting for all of my data for 4 full seconds even though some of it was ready much sooner.

GraphQL already has a solution for this called @defer and @stream directives, and I can't think of any place more important to implement support for this than in a graphQL gateway. I was actually quite surprised to not see it mentioned in the docs.

You can read more about it from this post from 2020: https://graphql.org/blog/2020-12-08-improving-latency-with-defer-and-stream-directives/

@defer and @stream directives are already implemented in competing technologies like apollo-server since 2018 (4 years ago)

Please consider adding this to graphql-mesh. It will be a huge performance boost for many use cases.

See apollo-server @defer implementation: https://www.apollographql.com/blog/community/backend/introducing-defer-in-apollo-server/

@ardatan
Copy link
Owner

ardatan commented May 17, 2022

GraphQL Mesh uses GraphQL js which doesn't support defer and stream and we also use schema stitching that needs to be aware of defer/stream usage.
graphql/graphql-js#2839
ardatan/graphql-tools#1941

@ardatan ardatan closed this as completed May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants