Skip to content

Commit

Permalink
Add comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenh committed May 3, 2023
1 parent d244e67 commit 26cbf41
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/graphql-resolver-utils/src/entityResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function entityResolver<T extends Entity, A extends Record<string, keyof
.map((ormField) => [
ormField.fieldName,
(entity: T, args, ctx, info: GraphQLResolveInfo) => {
// Use the `info` to see if the query is only returning `{ id }` and if so avoid fetching the entity
if ((ormField.kind === "m2o" || ormField.kind === "poly") && info.fieldNodes.length === 1) {
const selectionSet = info.fieldNodes[0].selectionSet;
if (selectionSet) {
Expand Down

0 comments on commit 26cbf41

Please sign in to comment.