From 8d1e1795a72a59daaccb008c048ccde55b6893bc Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 15 Jul 2022 17:37:32 +0200 Subject: [PATCH] feat(assist): fixed double sort --- utilities/utils/helper.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utilities/utils/helper.js b/utilities/utils/helper.js index e41c276b8..9844fa7d8 100644 --- a/utilities/utils/helper.js +++ b/utilities/utils/helper.js @@ -162,6 +162,9 @@ const sortPaginate = function (list, filters) { const tB = getValue(b, "timestamp"); return tA > tB ? 1 : tA < tB ? -1 : 0; }); + if (filters.sort.order) { + list.reverse(); + } if ((filters.sort.key || "timestamp") !== "timestamp") { list.sort((a, b) => { const vA = getValue(a, filters.sort.key);