-
Notifications
You must be signed in to change notification settings - Fork 393
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 for @defer directive in GraphQL #3206
Comments
any update on this? |
Disclaimer: Beware that using those directives is still an experimental feature as Apollo Server still does not support the latest spec of this directives. There is a As long as i know, there is no need to do something on NestJS side.
import { GraphQLDeferDirective, GraphQLStreamDirective } from 'graphql';
GraphQLModule.forRoot({
driver: ApolloDriver,
buildSchemaOptions: {
directives: [GraphQLDeferDirective, GraphQLStreamDirective],
},
})
|
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
I would like to propose the addition of support for the
@defer
directive in GraphQL within the Nest.js framework.The absence of support for the
@defer
directive in Nest.js presents a limitation for developers who are building GraphQL APIs with real-time or large datasets. Currently, Nest.js users are unable to take advantage of the@defer
directive, which allows GraphQL servers to send parts of the response as soon as they are available, rather than waiting for the entire query to be resolved. This can result in suboptimal performance and increased latency for applications dealing with complex queries or real-time data updates.Integrating support for the
@defer
directive into Nest.js would address this limitation and provide developers with a more efficient way to handle large and complex queries in GraphQL APIs. This enhancement would not only improve the performance and scalability of Nest.js applications but also contribute to a better overall developer experience.Describe the solution you'd like
I propose adding native support for the
@defer
directive in the Nest.js GraphQL module. This would involve implementing the necessary functionality to recognize and process@defer
directives within GraphQL queries handled by Nest.js servers.Additionally, it would be beneficial to provide configuration options for fine-tuning the behavior of
@defer
, such as setting timeouts for deferred fields or specifying the maximum number of concurrent deferred responses.By integrating support for
@defer
directly into the Nest.js framework, developers would have a seamless and efficient way to leverage this feature in their GraphQL APIs without relying on external libraries or custom implementations.What is the motivation / use case for changing the behavior?
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
The motivation behind adding support for the
@defer
directive in Nest.js is to enhance the performance and scalability of GraphQL APIs built with the framework.Use cases for this feature include:
Handling large and complex queries more efficiently by sending partial responses as soon as data becomes available, reducing overall latency for clients.
Supporting real-time data updates by deferring non-critical parts of the query, allowing critical data to be delivered to clients more quickly.
Improving the user experience for applications that rely on GraphQL APIs, especially those with interactive or real-time features, by minimizing wait times for query responses.
Overall, adding support for
@defer
in Nest.js would align the framework with modern best practices for building high-performance GraphQL APIs and provide developers with a powerful tool for optimizing query execution.The text was updated successfully, but these errors were encountered: