nestjs-dataloader
nestjs-dataloader copied to clipboard
add context in generateDataLoader to configure the query based on req
This PR will allow to configure how we resolve data based not only on a list of ids but also with the current graphql context.
@gouroujo I was about to make the same PR! :smiley: I was looking for a way to pass an access token from the request to a gRPC dataloader, and I settled for this solution. I think typing the context passed to generateDataLoader
as GraphQLExecutionContext
would be safer.
@krislefeber this shouldn't be breaking, existing data loaders can ignore the parameter and keep working as expected, even without overloading the generateDataLoader
method.
@gouroujo, if we can get typing added to the passed in context variable I will go ahead and make the merge. I see my mistake about the optional parameter
Is there any plan to merge this? It would be a great addition to this lib.
The alternative for me is to fork this repo and do it in my project but I would love to keep using this package 😄
Is there any update regarding this ?