diff --git a/front/src/applications/editor/components/LinearMetadata/FormLineStringLength.tsx b/front/src/applications/editor/components/LinearMetadata/FormLineStringLength.tsx index e58530ce835..3ad546ab07c 100644 --- a/front/src/applications/editor/components/LinearMetadata/FormLineStringLength.tsx +++ b/front/src/applications/editor/components/LinearMetadata/FormLineStringLength.tsx @@ -23,14 +23,10 @@ export const FormLineStringLength: React.FC = (props) => { */ useEffect(() => { const distance = getLineStringDistance(formContext.geometry); - if (formContext.isCreation) { - setTimeout(() => onChange(distance), 0); - } else { - setMin(Math.round(distance - distance * DISTANCE_ERROR_RANGE)); - setMax(Math.round(distance + distance * DISTANCE_ERROR_RANGE)); - setGeoLength(distance); - } - }, [formContext.geometry, formContext.isCreation, onChange]); + setMin(Math.round(distance - distance * DISTANCE_ERROR_RANGE)); + setMax(Math.round(distance + distance * DISTANCE_ERROR_RANGE)); + setGeoLength(distance); + }, [formContext.geometry, formContext.isCreation]); return (
@@ -49,7 +45,7 @@ export const FormLineStringLength: React.FC = (props) => { }} /> )} - {geoLength && (length < min || length > max) && ( + {geoLength > 0 && (length < min || length > max) && (

{t('Editor.errors.length-out-of-sync-with-geometry', { min, max })}.{' '}