From fa38fa1431b002e8806878d9a354348521c64a2c Mon Sep 17 00:00:00 2001 From: Tim Clifford Date: Mon, 22 Feb 2021 09:44:00 +0000 Subject: [PATCH] fixing sorting of created field to decending by default --- services/ui/src/components/Problems/sortedItems.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/ui/src/components/Problems/sortedItems.js b/services/ui/src/components/Problems/sortedItems.js index b9ba246ca6..fa9ee4cfaf 100644 --- a/services/ui/src/components/Problems/sortedItems.js +++ b/services/ui/src/components/Problems/sortedItems.js @@ -41,10 +41,10 @@ const useSortableProblemsData = (initialItems) => { } const requestSort = (key) => { - let direction = 'ascending'; + let direction = key !== 'created' ? 'ascending' : 'descending'; - if (sortConfig && sortConfig.key === key && sortConfig.direction === 'ascending') { - direction = 'descending'; + if (sortConfig && sortConfig.key === key && sortConfig.direction === direction) { + direction = direction === 'ascending' ? 'descending' : 'ascending'; } setCurrentItems(sortedItems);