Skip to content

Commit

Permalink
deferred fragments can be skipped if non-deferred
Browse files Browse the repository at this point in the history
now that we do not have duplication
  • Loading branch information
yaacovCR committed Jan 9, 2025
1 parent 76c0e90 commit ae933ea
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/execution/collectFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,21 +222,9 @@ function collectFieldsImpl(
case Kind.FRAGMENT_SPREAD: {
const fragName = selection.name.value;

const newDeferUsage = getDeferUsage(
variableValues,
fragmentVariableValues,
selection,
deferUsage,
);

if (
!newDeferUsage &&
(visitedFragmentNames.has(fragName) ||
!shouldIncludeNode(
selection,
variableValues,
fragmentVariableValues,
))
visitedFragmentNames.has(fragName) ||
!shouldIncludeNode(selection, variableValues, fragmentVariableValues)
) {
continue;
}
Expand All @@ -249,6 +237,13 @@ function collectFieldsImpl(
continue;
}

const newDeferUsage = getDeferUsage(
variableValues,
fragmentVariableValues,
selection,
deferUsage,
);

const fragmentVariableSignatures = fragment.variableSignatures;
let newFragmentVariableValues: VariableValues | undefined;
if (fragmentVariableSignatures) {
Expand Down

0 comments on commit ae933ea

Please sign in to comment.