Skip to content

Add tests for sorting over proj queryables with upstream OrderBy#9216

Merged
michaelstaib merged 3 commits into
mainfrom
mst/issue-5840
Jul 10, 2026
Merged

Add tests for sorting over proj queryables with upstream OrderBy#9216
michaelstaib merged 3 commits into
mainfrom
mst/issue-5840

Conversation

@michaelstaib

@michaelstaib michaelstaib commented Feb 25, 2026

Copy link
Copy Markdown
Member

Fixes #5840

# Conflicts:
#	src/HotChocolate/Data/src/Data/Sorting/Expressions/Extensions/QueryableSortContextExtensions.cs
Copilot AI review requested due to automatic review settings July 10, 2026 07:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent generic method binding failures when applying sorting to a projected IQueryable that already has an upstream OrderBy (e.g., OrderBy(Foo).Select(Bar)), by ensuring existing ordering is only considered “applicable” when the ordered element type matches the current source element type.

Changes:

  • Adds a regression test covering sorting on a projected queryable that already has an upstream OrderBy.
  • Extends the test Query with a projected field and supporting model types/data to reproduce the scenario.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +108 to +110
{
projectedWithExistingOrder(order: { someProperty: DESC }) {
someProperty
@michaelstaib michaelstaib changed the title Fix sorting over projected queryables with upstream OrderBy Add tests for sorting over proj queryables with upstream OrderBy Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OrderingMethodFinder does not respect the source queryable item type

2 participants