diff --git a/frontend/src/features/map/tools/measurements/CustomCircleRange.tsx b/frontend/src/features/map/tools/measurements/CustomCircleRange.tsx index 3467ab0ed4..33bb6aa161 100644 --- a/frontend/src/features/map/tools/measurements/CustomCircleRange.tsx +++ b/frontend/src/features/map/tools/measurements/CustomCircleRange.tsx @@ -88,8 +88,12 @@ export function CustomCircleRange() { ) const addCustomCircleRange = useCallback( - (nextCoordinates, nextCircleRadius) => { - dispatch( + async (nextCoordinates, nextCircleRadius) => { + if (!nextCoordinates?.length || !nextCircleRadius?.length) { + return + } + + await dispatch( setCircleMeasurementToAdd({ circleCoordinatesToAdd: nextCoordinates, circleRadiusToAdd: nextCircleRadius @@ -100,6 +104,7 @@ export function CustomCircleRange() { const extent = transformExtent(boundingExtent([formattedCoordinates]), WSG84_PROJECTION, OPENLAYERS_PROJECTION) dispatch(setFitToExtent(extent)) dispatch(setMeasurementTypeToAdd(undefined)) + dispatch(resetCircleMeasurementInDrawing()) }, [dispatch] ) @@ -131,6 +136,7 @@ export function CustomCircleRange() {
addCustomCircleRange(circleCoordinates, circleRadius)} > OK