graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Document UseDataLoader()

Open mausch opened this issue 2 years ago • 4 comments

Is your feature request related to a problem?

UseDataLoader was added in https://github.com/ChilliCream/hotchocolate/issues/2505 but there doesn't seem to be any documentation around it.

The solution you'd like

Document it maybe here? https://chillicream.com/docs/hotchocolate/fetching-data/dataloader

Product

Hot Chocolate

mausch avatar Jan 10 '22 12:01 mausch

Do you want to do a pull request?

michaelstaib avatar Jan 18 '22 07:01 michaelstaib

Hi, I'm new to HotChocolate, that's why I'm asking about this documentation :slightly_smiling_face:

mausch avatar Jan 18 '22 08:01 mausch

I am curious about the DataLoader middleware too. The graphql-workshop repository mentions (just above this) in session 6 that using a resolver alongside a dataloader causes paging to happen in memory:

There is one caveat in our implementation with the TrackType. Since, we are using a DataLoader within our resolver and first fetch the list of IDs we essentially will always fetch everything and chop in memory. In an actual project this can be split into two actions by moving the DataLoader part into a middleware and first page on the id queryable. Also one could implement a special IPagingHandler that uses the DataLoader and applies paging logic.

Would UseDataLoader() middleware resolve this inefficiency?

MarkoH17 avatar Feb 16 '22 14:02 MarkoH17

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 04 '22 00:05 stale[bot]

I believe this is still relevant. I have been unable to find documentation on UseDataLoader, which seems like a key component in stacking middlwares for custom resolvers.

@michaelstaib, can you shed some light on how this method should be used?

MarkoH17 avatar May 04 '22 21:05 MarkoH17

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 03 '22 21:07 stale[bot]