From ff0ea16e2a972596bdf8a954a6b4712d719202fe Mon Sep 17 00:00:00 2001 From: NatashaKoh Date: Sun, 30 May 2021 16:13:12 +0800 Subject: [PATCH] Fix task IDs are not sorted on multiple tasks validation sidebar Resolves #4689 --- frontend/src/components/taskSelection/action.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/taskSelection/action.js b/frontend/src/components/taskSelection/action.js index 3da539ea60..a189700667 100644 --- a/frontend/src/components/taskSelection/action.js +++ b/frontend/src/components/taskSelection/action.js @@ -40,9 +40,18 @@ export function TaskMapAction({ project, projectIsReady, tasks, activeTasks, act const [activeSection, setActiveSection] = useState('completion'); const [activeEditor, setActiveEditor] = useState(editor); const [showSidebar, setShowSidebar] = useState(true); - const tasksIds = useMemo(() => (activeTasks ? activeTasks.map((task) => task.taskId) : []), [ - activeTasks, - ]); + const tasksIds = useMemo( + () => + activeTasks + ? activeTasks + .map((task) => task.taskId) + .sort((n1, n2) => { + // in ascending order + return n1 - n2; + }) + : [], + [activeTasks], + ); const [disabled, setDisable] = useState(false); const [taskComment, setTaskComment] = useState(''); const [selectedStatus, setSelectedStatus] = useState();