Skip to content

Commit d8894ea

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

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/validation/rules/OverlappingFieldsCanBeMergedRule.ts

+10-7
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,

0 commit comments

Comments
 (0)