Skip to content

Commit a7f44f7

Browse files
committed
Reset requirements planner for every iteration.
1 parent 18ea63b commit a7f44f7

File tree

2 files changed

+39
-36
lines changed

2 files changed

+39
-36
lines changed

src/HotChocolate/Fusion/src/Core/Planning/Pipeline/RequirementsPlannerMiddleware.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ private static void Plan(QueryPlanContext context)
3232
currentStep.ParentSelection is { } parent &&
3333
currentStep.Resolver is not null)
3434
{
35+
schemas.Clear();
3536
siblingsToRemove.Clear();
3637
roots.Clear();
3738

@@ -65,7 +66,7 @@ currentStep.ParentSelection is { } parent &&
6566
}
6667

6768
// Tracks the most recent execution step (by query plan step order) targeting a given subgraph
68-
// Replacing a previous execution step if necessary.
69+
// Replacing a previous execution step if necessary.
6970
schemas[siblingExecutionStep.SubgraphName] = siblingExecutionStep;
7071
}
7172

src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_27_Multiple_Require_Steps_From_Same_Subgraph.snap

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,29 @@ QueryPlan
3333
"provides": [
3434
{
3535
"variable": "__fusion_exports__1"
36-
},
36+
}
37+
]
38+
},
39+
{
40+
"type": "Compose",
41+
"selectionSetIds": [
42+
0
43+
]
44+
},
45+
{
46+
"type": "Resolve",
47+
"subgraph": "Books",
48+
"document": "query Query_2($__fusion_exports__1: String!) { authorById(id: $__fusion_exports__1) { books { id __fusion_exports__2: authorId } } }",
49+
"selectionSetId": 1,
50+
"path": [
51+
"authorById"
52+
],
53+
"requires": [
54+
{
55+
"variable": "__fusion_exports__1"
56+
}
57+
],
58+
"provides": [
3759
{
3860
"variable": "__fusion_exports__2"
3961
}
@@ -42,51 +64,31 @@ QueryPlan
4264
{
4365
"type": "Compose",
4466
"selectionSetIds": [
45-
0
67+
1
4668
]
4769
},
4870
{
49-
"type": "Parallel",
50-
"nodes": [
71+
"type": "Resolve",
72+
"subgraph": "Authors",
73+
"document": "query Query_3($__fusion_exports__2: String!) { bookByAuthorId(authorId: $__fusion_exports__2) { author { __fusion_exports__3: id } } }",
74+
"selectionSetId": 2,
75+
"path": [
76+
"bookByAuthorId"
77+
],
78+
"requires": [
5179
{
52-
"type": "Resolve",
53-
"subgraph": "Books",
54-
"document": "query Query_2($__fusion_exports__1: String!) { authorById(id: $__fusion_exports__1) { books { id } } }",
55-
"selectionSetId": 1,
56-
"path": [
57-
"authorById"
58-
],
59-
"requires": [
60-
{
61-
"variable": "__fusion_exports__1"
62-
}
63-
]
64-
},
80+
"variable": "__fusion_exports__2"
81+
}
82+
],
83+
"provides": [
6584
{
66-
"type": "Resolve",
67-
"subgraph": "Authors",
68-
"document": "query Query_3($__fusion_exports__2: String!) { bookByAuthorId(authorId: $__fusion_exports__2) { author { __fusion_exports__3: id } } }",
69-
"selectionSetId": 2,
70-
"path": [
71-
"bookByAuthorId"
72-
],
73-
"requires": [
74-
{
75-
"variable": "__fusion_exports__2"
76-
}
77-
],
78-
"provides": [
79-
{
80-
"variable": "__fusion_exports__3"
81-
}
82-
]
85+
"variable": "__fusion_exports__3"
8386
}
8487
]
8588
},
8689
{
8790
"type": "Compose",
8891
"selectionSetIds": [
89-
1,
9092
2
9193
]
9294
},

0 commit comments

Comments
 (0)