Skip to content

Commit a0efedb

Browse files
committed
fix: harden sort
1 parent 3dc02a5 commit a0efedb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

QueryKit/QueryKitExtensions.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ public static IOrderedQueryable<T> ApplyQueryKitSort<T>(this IQueryable<T> query
3838
var sortLambdas = SortParser.ParseSort<T>(sortExpression, config);
3939

4040
if (sortLambdas.Count == 0)
41-
{
42-
return queryable.OrderBy(x => x);
43-
}
41+
return queryable.OrderBy(_ => 0);
4442

4543
var firstSortInfo = sortLambdas[0];
4644
if (firstSortInfo.Expression != null)
@@ -103,7 +101,7 @@ public static IOrderedEnumerable<T> ApplyQueryKitSort<T>(
103101
var sortInfos = SortParser.ParseSort<T>(sortExpression, config);
104102

105103
if (sortInfos.Count == 0 || sortInfos[0].Expression is null)
106-
return source.OrderBy(x => x);
104+
return source.OrderBy(_ => 0);
107105

108106
var first = sortInfos[0];
109107
var ordered = first.IsAscending

0 commit comments

Comments
 (0)