From f252b3586ac1f64cc246d9ffd4c07bcbebca755c Mon Sep 17 00:00:00 2001 From: Nishit Suwal <81785002+NSUWAL123@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:57:08 +0545 Subject: [PATCH] fix (createNewProject): splitTasks - number of tasks and map updated when options changed to choose_area_as_task (#967) --- .../src/components/createnewproject/SplitTasks.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/createnewproject/SplitTasks.tsx b/src/frontend/src/components/createnewproject/SplitTasks.tsx index dfc98588e3..c2bc7843e7 100644 --- a/src/frontend/src/components/createnewproject/SplitTasks.tsx +++ b/src/frontend/src/components/createnewproject/SplitTasks.tsx @@ -112,6 +112,12 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customLineUpload, custo dispatch(CreateProjectActions.SetIndividualProjectDetailsData({ ...projectDetails, ...formValues })); }; + useEffect(() => { + if (splitTasksSelection === 'choose_area_as_task') { + dispatch(CreateProjectActions.SetDividedTaskGeojson(null)); + } + }, [splitTasksSelection]); + const { handleSubmit, handleCustomChange, @@ -228,7 +234,7 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customLineUpload, custo )); }; - const parsedTaskGeojsonCount = dividedTaskGeojson?.features?.length || drawnGeojson?.features?.length; + const parsedTaskGeojsonCount = dividedTaskGeojson?.features?.length || drawnGeojson?.features?.length || 1; const totalSteps = dividedTaskGeojson?.features ? dividedTaskGeojson?.features?.length : parsedTaskGeojsonCount; return ( <> @@ -299,7 +305,7 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customLineUpload, custo )} > )} - {formValues.splitTaskOption === 'task_splitting_algorithm' && ( + {splitTasksSelection === 'task_splitting_algorithm' && ( <>
Average number of buildings per task: