Repository navigation
Fix pagination fields losing parallel execution - #10564
Conversation
The edges, nodes and totalCount fields of connection types, and the items and totalCount fields of collection segment types, replaced their field flags and cleared ParallelExecutable. When a schema registers global field middleware these fields compile without a pure resolver, so they stayed serial. The ParallelExecutable flag is now kept, as for the node and nodes fields (ChilliCream#7661).
There was a problem hiding this comment.
🟢 Approval recommended
The narrow flag fix preserves existing metadata, and regression tests cover the reported middleware condition; tests were not executed.
0 open findings
What changed in this PR
Restores parallel execution for pagination fields when global field middleware is registered, addressing #10563.
Changes:
- Preserves
ParallelExecutablealongside existing pagination field flags. - Adds regression tests for connection and collection segment fields with global middleware.
| File | Description |
|---|---|
| src/HotChocolate/Core/test/Types.OffsetPagination.Tests/CollectionSegmentTypeTests.cs | Verifies collection segment fields remain parallel executable. |
| src/HotChocolate/Core/test/Types.CursorPagination.Tests/ConnectionTypeTests.cs | Verifies connection fields remain parallel executable. |
| src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs | Preserves parallel execution for items and totalCount. |
| src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs | Preserves parallel execution for edges, nodes, and totalCount. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
michaelstaib
left a comment
There was a problem hiding this comment.
This one is wrong. TotalCount is not an async field but a pure resolver. This means they are folded into the execution of the parent.
I will close the PR, while you could technically execute them in parallel that would lead to a task wrapped around this and fields would be handled in their own execution task which would lead to slower execution.
The edges, nodes and totalCount fields of connection types, and the items and totalCount fields of collection segment types, replaced their field flags and cleared ParallelExecutable. When a schema registers global field middleware these fields compile without a pure resolver, so they stayed serial. The ParallelExecutable flag is now kept, as for the node and nodes fields (#7661).
fixes #10563