Merged PR 1915: fix(remission-list-resource): only apply default sorting when no orderBy spec...

fix(remission-list-resource): only apply default sorting when no orderBy specified

Replace default sort mechanism to respect explicit orderBy from QueryToken.
Previously, the resource always applied manual sorting regardless of whether
explicit ordering was requested, causing conflicts with user-defined sorting.

Now checks if queryToken.orderBy exists and has items before applying the
default sort behavior (manually-added items first, then by created date).

Refs: #5276
This commit is contained in:
Nino Righi
2025-08-13 09:51:25 +00:00
committed by Andreas Schickinger
parent 2af16d92ea
commit e4f289c67d

View File

@@ -126,7 +126,10 @@ export const createRemissionListResource = (
throw new ResponseArgsError(res);
}
if (res && res.result && Array.isArray(res.result)) {
// #5276 Fix - Replace defaultSort Mechanism with orderBy from QueryToken if available
const hasOrderBy = !!queryToken?.orderBy && queryToken.orderBy.length > 0;
if (!hasOrderBy && res && res.result && Array.isArray(res.result)) {
sortResponseResult(res);
}