Skip to content

Commit

Permalink
refactor: Remove redundant iteration in EntitySelectionTree merging a…
Browse files Browse the repository at this point in the history
…lgorithm (#308)
  • Loading branch information
AnthonyMDev authored Mar 22, 2024
1 parent b90f662 commit a8fcb77
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions apollo-ios-codegen/Sources/IR/IR+EntitySelectionTree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,23 +224,6 @@ class EntitySelectionTree {
targetSelections.mergeIn(scopeSelections, from: source)
}

if let conditionalScopes = scopeConditions {
for (condition, node) in conditionalScopes {
guard !node.scope.isDeferred else { continue }

if scopePathNode.value.matches(condition) {
node.mergeSelections(
matchingScopePath: scopePathNode,
into: targetSelections,
transformingSelections: transformingSelections
)

} else {
targetSelections.addMergedInlineFragment(with: condition)
}
}
}

case .none: break
}

Expand All @@ -254,6 +237,8 @@ class EntitySelectionTree {
into: targetSelections,
transformingSelections: transformingSelections
)
} else if case .selections = child {
targetSelections.addMergedInlineFragment(with: condition)
}
}
}
Expand Down

0 comments on commit a8fcb77

Please sign in to comment.