From 26cbf41531578e8069f154442ff853ea00a55313 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Tue, 2 May 2023 20:21:20 -0500 Subject: [PATCH] Add comment. --- packages/graphql-resolver-utils/src/entityResolver.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/graphql-resolver-utils/src/entityResolver.ts b/packages/graphql-resolver-utils/src/entityResolver.ts index 26e7c20bf..dc47a90bb 100644 --- a/packages/graphql-resolver-utils/src/entityResolver.ts +++ b/packages/graphql-resolver-utils/src/entityResolver.ts @@ -76,6 +76,7 @@ export function entityResolver [ 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) {