Skip to content

Commit 002a2ad

Browse files
Apply suggestion
Co-Authored-By: yaacovCR <[email protected]>
1 parent f6fd3cf commit 002a2ad

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/validation/rules/OverlappingFieldsCanBeMergedRule.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -485,24 +485,27 @@ function findConflictsBetweenSubSelectionSets(
485485

486486
// (E) Then collect any conflicts between the provided collection of fields
487487
// and any fragment names found in the given fragment.
488-
const processDiscoveredFragments = (
488+
function processDiscoveredFragments(
489489
context: ValidationContext,
490490
conflicts: Array<Conflict>,
491491
cachedFieldsAndFragmentNames: Map<SelectionSetNode, FieldsAndFragmentNames>,
492492
comparedFragmentPairs: PairSet,
493493
areMutuallyExclusive: boolean,
494494
fieldMap: NodeAndDefCollection,
495495
discoveredFragments: Array<Array<string>>,
496-
) => {
497-
while (discoveredFragments.length !== 0) {
498-
const item = discoveredFragments.pop();
496+
) {
497+
let item;
498+
while ((item = discoveredFragments.pop()) !== undefined) {
499+
const [fragmentName, referencedFragmentName] = item;
499500
if (
500-
!item ||
501-
comparedFragmentPairs.has(item[1], item[0], areMutuallyExclusive)
501+
comparedFragmentPairs.has(
502+
referencedFragmentName,
503+
fragmentName,
504+
areMutuallyExclusive,
505+
)
502506
) {
503507
continue;
504508
}
505-
const [fragmentName, referencedFragmentName] = item;
506509
comparedFragmentPairs.add(
507510
referencedFragmentName,
508511
fragmentName,
@@ -519,7 +522,7 @@ const processDiscoveredFragments = (
519522
discoveredFragments,
520523
);
521524
}
522-
};
525+
}
523526

524527
// Collect all Conflicts "within" one collection of fields.
525528
function collectConflictsWithin(

0 commit comments

Comments
 (0)