From f94bf1f2065aaf9908c6bc7c990269f694ef8016 Mon Sep 17 00:00:00 2001 From: lemmy mwaura Date: Sun, 11 Dec 2022 23:31:31 +0300 Subject: [PATCH] feat:only sort on reorder and cleanup changes --- frontend/pages/dashboard/[id].js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/pages/dashboard/[id].js b/frontend/pages/dashboard/[id].js index 1182dd56b..187f0c340 100644 --- a/frontend/pages/dashboard/[id].js +++ b/frontend/pages/dashboard/[id].js @@ -266,9 +266,12 @@ export default function Dashboard() { * Reorder rows alphabetically or in the opprosite order */ const reorderRows = () => { - setSortMethod( - sortMethod == "alphabetical" ? "-alphabetical" : "alphabetical" + setSortMethod(prevSort => + prevSort == "alphabetical" + ? "-alphabetical" + : "alphabetical" ); + sortValuesHandler() }; @@ -404,9 +407,8 @@ export default function Dashboard() { }); } - // Once "Save changed is clicked", disable that button and sort values + // Once "Save changed is clicked", disable that button setButtonReady(false); - sortValuesHandler() pushKeys({ obj, workspaceId: router.query.id, env }); /** @@ -449,8 +451,6 @@ export default function Dashboard() { }; const sortValuesHandler = () => { - console.log(sortMethod) - const sortedData = data.sort((a, b) => sortMethod == "alphabetical" ? a.key.localeCompare(b.key) @@ -600,7 +600,7 @@ export default function Dashboard() {