Skip to content

Commit 4deac7f

Browse files
kroupaczTomas Kroupa
andauthored
fix(federation): continue if currentUnavailableSelectionSet.selections is empty array (#6598)
Co-authored-by: Tomas Kroupa <[email protected]>
1 parent 1ebdb08 commit 4deac7f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@graphql-tools/federation": patch
3+
---
4+
5+
If `currentUnavailableSelectionSet.selections` is empty array then "query planning" will fail.

packages/federation/src/supergraph.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,11 @@ export function getStitchingOptionsFromSupergraphSdl(
10781078
// that can resolve the remaining fields for this selection directly from the root field
10791079
// instead of applying a type merging in advance
10801080
for (const friendCandidate of realCandidates) {
1081-
if (friendCandidate === candidate || !friendCandidate.transformedSubschema) {
1081+
if (
1082+
friendCandidate === candidate ||
1083+
!friendCandidate.transformedSubschema ||
1084+
!currentUnavailableSelectionSet.selections.length
1085+
) {
10821086
continue;
10831087
}
10841088
const unavailableFieldsInFriend = extractUnavailableFieldsFromSelectionSet(

0 commit comments

Comments
 (0)