diff --git a/app/layout/project/sidebar/scenario/grid-setup/protected-areas/threshold/index.tsx b/app/layout/project/sidebar/scenario/grid-setup/protected-areas/threshold/index.tsx index 7579ecbedc..a3cc8eab0a 100644 --- a/app/layout/project/sidebar/scenario/grid-setup/protected-areas/threshold/index.tsx +++ b/app/layout/project/sidebar/scenario/grid-setup/protected-areas/threshold/index.tsx @@ -120,64 +120,48 @@ export const WDPAThreshold = ({ onGoBack }: { onGoBack: () => void }): JSX.Eleme const areProjectPAreasSelected = !!projectPAreasSelectedIds.length; const handleSubmit = useCallback( - (values, form) => { + (values) => { const { wdpaThreshold } = values; - const thresholdTouched = form.getFieldState('wdpaThreshold')?.dirty; - - if (thresholdTouched) { - setSubmitting(true); - saveScenarioProtectedAreasMutation.mutate( - { - id: `${sid}`, - data: { - areas: selectedProtectedAreas, - threshold: +(wdpaThreshold * 100).toFixed(0), - }, + setSubmitting(true); + saveScenarioProtectedAreasMutation.mutate( + { + id: `${sid}`, + data: { + areas: selectedProtectedAreas, + threshold: +(wdpaThreshold * 100).toFixed(0), }, - { - onSuccess: () => { - addToast( - 'save-scenario-wdpa', - <> -
Scenario protected areas threshold saved
- >, - { - level: 'success', - } - ); - }, - onError: () => { - addToast( - 'error-scenario-wdpa', - <> -Scenario protected areas threshold not saved
- >, - { - level: 'error', - } - ); - }, - onSettled: () => { - setSubmitting(false); - }, - } - ); - } - if (!thresholdTouched) { - addToast( - 'save-scenario-wdpa', - <> - -No modifications have been made to the protected areas.
- >, - { - level: 'info', - } - ); - } + }, + { + onSuccess: () => { + addToast( + 'save-scenario-wdpa', + <> +Scenario protected areas threshold saved
+ >, + { + level: 'success', + } + ); + }, + onError: () => { + addToast( + 'error-scenario-wdpa', + <> +Scenario protected areas threshold not saved
+ >, + { + level: 'error', + } + ); + }, + onSettled: () => { + setSubmitting(false); + }, + } + ); }, [saveScenarioProtectedAreasMutation, selectedProtectedAreas, sid, addToast] );