Skip to content

add support for @defer and @stream directives #3892

@MarkLyck

Description

@MarkLyck

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions