diff --git a/src/HotChocolate/Fusion/src/Core/Planning/Pipeline/RequirementsPlannerMiddleware.cs b/src/HotChocolate/Fusion/src/Core/Planning/Pipeline/RequirementsPlannerMiddleware.cs index 3baaf45eabb..59c485ea2a7 100644 --- a/src/HotChocolate/Fusion/src/Core/Planning/Pipeline/RequirementsPlannerMiddleware.cs +++ b/src/HotChocolate/Fusion/src/Core/Planning/Pipeline/RequirementsPlannerMiddleware.cs @@ -32,6 +32,7 @@ private static void Plan(QueryPlanContext context) currentStep.ParentSelection is { } parent && currentStep.Resolver is not null) { + schemas.Clear(); siblingsToRemove.Clear(); roots.Clear(); @@ -65,7 +66,7 @@ currentStep.ParentSelection is { } parent && } // Tracks the most recent execution step (by query plan step order) targeting a given subgraph - // Replacing a previous execution step if necessary. + // Replacing a previous execution step if necessary. schemas[siblingExecutionStep.SubgraphName] = siblingExecutionStep; } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_27_Multiple_Require_Steps_From_Same_Subgraph.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_27_Multiple_Require_Steps_From_Same_Subgraph.snap index 98769d7a26b..4853c4e1471 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_27_Multiple_Require_Steps_From_Same_Subgraph.snap +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_27_Multiple_Require_Steps_From_Same_Subgraph.snap @@ -33,7 +33,29 @@ QueryPlan "provides": [ { "variable": "__fusion_exports__1" - }, + } + ] + }, + { + "type": "Compose", + "selectionSetIds": [ + 0 + ] + }, + { + "type": "Resolve", + "subgraph": "Books", + "document": "query Query_2($__fusion_exports__1: String!) { authorById(id: $__fusion_exports__1) { books { id __fusion_exports__2: authorId } } }", + "selectionSetId": 1, + "path": [ + "authorById" + ], + "requires": [ + { + "variable": "__fusion_exports__1" + } + ], + "provides": [ { "variable": "__fusion_exports__2" } @@ -42,51 +64,31 @@ QueryPlan { "type": "Compose", "selectionSetIds": [ - 0 + 1 ] }, { - "type": "Parallel", - "nodes": [ + "type": "Resolve", + "subgraph": "Authors", + "document": "query Query_3($__fusion_exports__2: String!) { bookByAuthorId(authorId: $__fusion_exports__2) { author { __fusion_exports__3: id } } }", + "selectionSetId": 2, + "path": [ + "bookByAuthorId" + ], + "requires": [ { - "type": "Resolve", - "subgraph": "Books", - "document": "query Query_2($__fusion_exports__1: String!) { authorById(id: $__fusion_exports__1) { books { id } } }", - "selectionSetId": 1, - "path": [ - "authorById" - ], - "requires": [ - { - "variable": "__fusion_exports__1" - } - ] - }, + "variable": "__fusion_exports__2" + } + ], + "provides": [ { - "type": "Resolve", - "subgraph": "Authors", - "document": "query Query_3($__fusion_exports__2: String!) { bookByAuthorId(authorId: $__fusion_exports__2) { author { __fusion_exports__3: id } } }", - "selectionSetId": 2, - "path": [ - "bookByAuthorId" - ], - "requires": [ - { - "variable": "__fusion_exports__2" - } - ], - "provides": [ - { - "variable": "__fusion_exports__3" - } - ] + "variable": "__fusion_exports__3" } ] }, { "type": "Compose", "selectionSetIds": [ - 1, 2 ] },