Skip to content

Commit

Permalink
fix(build-operation-for-field): respect field depth (#1953)
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Aug 26, 2020
1 parent c315786 commit 242efa0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/utils/src/build-operation-for-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,13 @@ function resolveField({
return null as any;
}

const fieldPath = [...path, field.name];
const fieldPathStr = fieldPath.join('.');
let fieldName = field.name;
if (fieldTypeMap.has(fieldName) && fieldTypeMap.get(fieldName) !== field.type.toString()) {
if (fieldTypeMap.has(fieldPathStr) && fieldTypeMap.get(fieldPathStr) !== field.type.toString()) {
fieldName += (field.type as any).toString().replace('!', 'NonNull');
}
fieldTypeMap.set(fieldName, field.type.toString());
fieldTypeMap.set(fieldPathStr, field.type.toString());

if (!isScalarType(namedType) && !isEnumType(namedType)) {
return {
Expand All @@ -487,7 +489,7 @@ function resolveField({
type: namedType,
models,
firstCall,
path: [...path, field.name],
path: fieldPath,
ancestors: [...ancestors, type],
ignore,
depthLimit,
Expand Down

0 comments on commit 242efa0

Please sign in to comment.