Skip to content

Commit

Permalink
Backport fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Dec 20, 2023
1 parent 5493930 commit 7102d25
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/validation/rules/OverlappingFieldsCanBeMergedRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,24 @@ function collectConflictsBetweenFieldsAndFragment(
// (E) Then collect any conflicts between the provided collection of fields
// and any fragment names found in the given fragment.
for (let i = 0; i < fragmentNames2.length; i++) {
const referencedFragmentName = fragmentNames2[i];

// Memoize so two fragments are not compared for conflicts more than once.
if (
comparedFragmentPairs.has(
referencedFragmentName,
fragmentName,
areMutuallyExclusive,
)
) {
continue;
}
comparedFragmentPairs.add(
referencedFragmentName,
fragmentName,
areMutuallyExclusive,
);

collectConflictsBetweenFieldsAndFragment(
context,
conflicts,
Expand Down

0 comments on commit 7102d25

Please sign in to comment.