From b3304745b1fcfcb1c1006cdafdf6f6a3eb7ae9ae Mon Sep 17 00:00:00 2001 From: Sujit Date: Wed, 25 Sep 2024 10:08:44 +0545 Subject: [PATCH] feat(task-description): all the variables related to take-off point updation reset to initial state on component unmount --- .../src/components/DroneOperatorTask/MapSection/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx b/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx index 5666af81..9d12e1ab 100644 --- a/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx +++ b/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx @@ -12,7 +12,10 @@ import { GeojsonType } from '@Components/common/MapLibreComponents/types'; import { Button } from '@Components/RadixComponents/Button'; import { postTaskWaypoint } from '@Services/tasks'; import { toggleModal } from '@Store/actions/common'; -import { setSelectedTakeOffPoint } from '@Store/actions/droneOperatorTask'; +import { + setSelectedTakeOffPoint, + setSelectedTakeOffPointOption, +} from '@Store/actions/droneOperatorTask'; import { useTypedSelector } from '@Store/hooks'; import { useMutation, useQueryClient } from '@tanstack/react-query'; import getBbox from '@turf/bbox'; @@ -81,6 +84,7 @@ const MapSection = ({ className }: { className?: string }) => { return data; }); dispatch(setSelectedTakeOffPoint(null)); + dispatch(setSelectedTakeOffPointOption('current_location')); }, onError: (err: any) => { toast.error(err?.response?.data?.detail || err.message); @@ -158,6 +162,7 @@ const MapSection = ({ className }: { className?: string }) => { useEffect( () => () => { dispatch(setSelectedTakeOffPoint(null)); + dispatch(setSelectedTakeOffPointOption('current_location')); }, [dispatch], );