feat: refs #7793 perf sortByWeight

This commit is contained in:
Javier Segarra 2024-09-25 22:51:05 +02:00
parent 3476b4807f
commit 2d55013a90
1 changed files with 4 additions and 4 deletions

View File

@ -191,10 +191,10 @@ async function fetchFilter(val) {
const fetchOptions = { where, include, limit }; const fetchOptions = { where, include, limit };
if (fields) fetchOptions.fields = fields; if (fields) fetchOptions.fields = fields;
if (sortBy) { if (sortBy) {
let sort = sortBy; fetchOptions.order = [
if (typeof sort === 'string') sort = [getOrderCaseString(key, val), sortBy]; getOrderCaseString(key, val),
else sort = [getOrderCaseString(key, val), ...sortBy]; typeof sortBy === 'string' ? sortBy : [...sortBy],
fetchOptions.order = sort; ];
} }
return dataRef.value.fetch(fetchOptions); return dataRef.value.fetch(fetchOptions);