Skip to content

Commit 784b74f

Browse files
committed
Excessive efficiency
1 parent 18d6927 commit 784b74f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/validation/rules/MaxIntrospectionDepthRule.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ export function MaxIntrospectionDepthRule(
1717
*/
1818
function checkDepth(
1919
node: ASTNode,
20-
visitedFragments: { [fragmentName: string]: true },
20+
visitedFragments: { [fragmentName: string]: true | undefined },
2121
depth: number = 0,
2222
): boolean {
2323
if (node.kind === Kind.FRAGMENT_SPREAD) {
2424
const fragmentName = node.name.value;
25-
if (visitedFragments[fragmentName]) {
25+
if (visitedFragments[fragmentName] === true) {
2626
// Fragment cycles are handled by `NoFragmentCyclesRule`.
2727
return false;
2828
}
@@ -41,7 +41,7 @@ export function MaxIntrospectionDepthRule(
4141
visitedFragments[fragmentName] = true;
4242
return checkDepth(fragment, visitedFragments, depth);
4343
} finally {
44-
delete visitedFragments[fragmentName];
44+
visitedFragments[fragmentName] = undefined;
4545
}
4646
}
4747

0 commit comments

Comments
 (0)