Repository navigation
Fix QueryContext sorting dropping expression-based sort fields - #10773
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are blocking approval of the sorting change.
No open issues 🎉
What changed in this PR
Fixes QueryContext sorting so expression-defined fields are preserved when converting sorting input into a sort definition.
Changes:
- Builds selectors from expression metadata, validates lambda parameters, and supports method-backed fields.
- Reuses the existing parameter-replacement visitor.
- Adds a regression test verifying that expression-based and property-based sort fields are both retained in order.
| File | Description |
|---|---|
src/HotChocolate/Data/test/Data.Sorting.Tests/Context/SortingContextTests.cs |
Tests mixed expression-based and property-based sorting. |
src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableDefaultSortFieldHandler.cs |
Makes the parameter-replacement visitor available internally for reuse. |
src/HotChocolate/Data/src/Data/Sorting/Context/SortingContext.cs |
Preserves expression-defined sort selectors and handles method-backed fields. |
Review effort: Balanced
Contributor
Patch coverage80.0% of changed lines covered (12/15)
Uncovered changed lines (JSON){
"sha": "de5f1d5e9568dfca06cd1e9507015295701272a7",
"files": [
{ "path": "src/HotChocolate/Data/src/Data/Sorting/Context/SortingContext.cs", "ranges": [[224, 225], [237, 237]] }
]
}Project coverage: 59.3% (319210/538368 lines) |
This was referenced Nov 10, 2026
chore(deps): Bump HotChocolate.Subscriptions.InMemory from 16.7.3 to 16.7.5
Kuestenlogik/Bowire#1025
Merged
This was referenced Nov 19, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 32 others
AdCodicem/AdCodicem.ValueObjects#262
Closed
This was referenced Nov 26, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 43 others
AdCodicem/AdCodicem.ValueObjects#274
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10754