Skip to content

Commit 4d153df

Browse files
committed
remove unneeded check for cycles
1 parent 81ebe2a commit 4d153df

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

src/execution/__tests__/abstract-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ describe('Execute: Handles execution of abstract types', () => {
752752
// FIXME: workaround since we can't inject resolveType into SDL
753753
petType.resolveType = () => 'Pet';
754754
expectError().toEqual(
755-
'Abstract type resolution for "Named" for field "Query.named" failed. Encountered abstract type "Pet" resolved to "Pet", causing a cycle.',
755+
'Abstract type resolution for "Named" for field "Query.named" failed. Interface type "Pet" is not a subtype of encountered interface type "Named".',
756756
);
757757
});
758758
});

src/execution/execute.ts

-13
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,6 @@ function resolveType(
840840
fieldNodes: ReadonlyArray<FieldNode>,
841841
info: GraphQLResolveInfo,
842842
result: unknown,
843-
encounteredTypeNames: Set<string> = new Set(),
844843
): GraphQLObjectType | Promise<GraphQLObjectType> {
845844
const resolveTypeFn = abstractType.resolveType ?? exeContext.typeResolver;
846845
const contextValue = exeContext.contextValue;
@@ -861,7 +860,6 @@ function resolveType(
861860
fieldNodes,
862861
info,
863862
result,
864-
encounteredTypeNames,
865863
),
866864
);
867865
}
@@ -873,7 +871,6 @@ function resolveType(
873871
fieldNodes,
874872
info,
875873
result,
876-
encounteredTypeNames,
877874
);
878875
}
879876

@@ -885,7 +882,6 @@ function deriveRuntimeType(
885882
fieldNodes: ReadonlyArray<FieldNode>,
886883
info: GraphQLResolveInfo,
887884
result: unknown,
888-
encounteredTypeNames: Set<string>,
889885
): GraphQLObjectType | Promise<GraphQLObjectType> {
890886
if (runtimeTypeName == null) {
891887
throw new GraphQLError(
@@ -913,14 +909,6 @@ function deriveRuntimeType(
913909
);
914910
}
915911

916-
if (encounteredTypeNames.has(runtimeTypeName)) {
917-
throw new GraphQLError(
918-
`Abstract type resolution for "${returnType.name}" for field "${info.parentType.name}.${info.fieldName}" failed. ` +
919-
`Encountered abstract type "${currentAbstractType.name}" resolved to "${runtimeTypeName}", causing a cycle.`,
920-
);
921-
}
922-
encounteredTypeNames.add(runtimeTypeName);
923-
924912
const runtimeType = exeContext.schema.getType(runtimeTypeName);
925913
if (runtimeType == null) {
926914
throw new GraphQLError(
@@ -946,7 +934,6 @@ function deriveRuntimeType(
946934
fieldNodes,
947935
info,
948936
result,
949-
encounteredTypeNames,
950937
);
951938
}
952939

0 commit comments

Comments
 (0)