Repository navigation
Added DataLoader Projections - #7389
Merged
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7389 +/- ##
==========================================
+ Coverage 76.29% 77.27% +0.98%
==========================================
Files 2492 2813 +321
Lines 124112 140864 +16752
==========================================
+ Hits 94686 108849 +14163
- Misses 29426 32015 +2589
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
michaelstaib
marked this pull request as ready for review
August 21, 2024 21:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR builds on top of the new transient state in DataLoader. With this PR you can now use inferred projections (inferred from a
ISelectionand exlicit projections)This is how it works:
Let's say we have a resolver that fetches an author that uses a DataLoader.
On the DataLoader when we are in a resolver we can do a
Selecton the current selected field ... which will traverse the subfields and build a selection expression.If we have a more layered approach we still can do this as we also are able to build the expression explicitly from the
ISelection.We can also manually include things as opposed to using a GraphQL field selection.
On the DataLoader side we do not have any dependencies on HotChocolate itself and can create the DataLoader in isolation.
The DataLoader can inject the
ISelectorContextfrom its current state and with that build the combined expression to project with anIQueryable<T>.--> This feature is marked as experimental for 14.0. <--
Todos:
Fixes #6191