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) {