From ca448189d5ee0145ca019bb23a69b7cda516fb99 Mon Sep 17 00:00:00 2001 From: Nipun Arora Date: Fri, 8 Nov 2024 15:17:56 +0530 Subject: [PATCH] Update SetupMicroplan.js --- .../microplan/src/pages/employee/SetupMicroplan.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js index 6f2ff583634..5db5bd1dc3e 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js @@ -160,7 +160,6 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => { setLoader(true); updateResources(propsForMutate, { onSuccess: (data) => { - setLoader(false); // Check if there is a redirectTo property in the response if (data?.redirectTo) { history.push(data?.redirectTo, data?.state); // Navigate to the specified route @@ -199,6 +198,10 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => { HYPOTHESIS: null, FORMULA_CONFIGURATION: null, }); + + setCurrentKey((prev) => prev + 1); + setCurrentStep((prev) => prev + 1); + //since we are invalidating we need to update this global state dispatch({ type: "MASTER_DATA", @@ -206,9 +209,9 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => { allAssumptions:[], }, }); - setCurrentKey((prev) => prev + 1); - setCurrentStep((prev) => prev + 1); } + + setLoader(false); }, onError: (error, variables) => { setLoader(false);