Batchloaders nesting #1826
Unanswered
MarianneHorsch
asked this question in
Q&A
Replies: 1 comment
-
Hi @MarianneHorsch! Would you mind sharing your datafetcher/dataloader code so I can better understand how you are implementing this? It's a bit convoluted to understand exactly what you have currently, but sounds like you are on the right track.
Again, this is just hypothetical, but I can provide more pointed feedback if you share your implemented logic. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
I'm struggeling with my Graphql service to get my scenario working. Lets asume I have this schema:
My companies come from the CompanyService, departments can be retrieved in batches based on the companyID and return a list with employeeIds that are testers and a list with employeeIds that are softwareEngineers, employers can be retrieved in batches from the EmployeeService based on employeeId.
So first I created a MappedBatchLoaderWithContext (context is only because of my real case needs context) to fetch the departments then when the results are in I want to have another MappedBatchLoaderWithContext to fetch the employers. I used. a DepartmentsDataFetcher and a EmployerDataFetcher but no matter what I do it seems that the graphQL query returns its result before the EmployeeService data is added. I see the EmployeeService is being called, I see the response in the dataloader but it never ends up in my query.
I read the part about Chaining Data loaders but since my EmployeeService only returns an employee and nothing about the department the code is not pretty (I need to merge the 2 objects myself) I would prefer to get this working with 2 seperate datafetchers one for type Department and one for type Employee, this makes the Employee datafetcher a third step in execution (first the companies, second in batches the deparments and third iteration the employers). Is this possible with DGS?? How can I solve this issue?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions