-
Notifications
You must be signed in to change notification settings - Fork 91
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
Feature Request - Pass DataFetchingEnvironment to the BatchLoader. #26
Comments
I have just added a capability into the library to allow context to be provided to the batch loader function
Note it is NOT per Rather is is a provider model on the DataLoader options. The provider of context is called when the batch load function is dispatched. In the case of graphql you will need to have a "mutable" provider that you "set" target fields into. Let us know if this helps you. |
This has changed since I post the above. See the readme for more details |
This has been added in 2.1.1 |
The dataloader library seems to give me most of the functionality I'm looking for when trying to batch my DB queries for a layer of a graphql query. I am working with very large documents in the database I'm querying, and I'd rather optimize my queries to the database so that I only request the information from the database necessary to fulfill the graphql query.
I'm able to determine the required set of data based on the DataFetchingEnvironment that's passed to the DataFetcher, but I see no way to pass that information downstream to the BatchLoader. Having that object, or any other custom object containing the contextual data I need for that layer of the query, would enable the optimization I'm looking for.
The text was updated successfully, but these errors were encountered: