Merge pull request #9979 from mfo/US/fix-point-input

ETQ usager: fix comportement des marqueurs de la carte dans les blocs répétables
This commit is contained in:
Colin Darie 2024-02-09 10:03:50 +00:00 committed by GitHub
commit c4bdef3a1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View file

@ -147,16 +147,20 @@ function useExternalEvents(
const onFeatureCreate = useCallback( const onFeatureCreate = useCallback(
({ detail }) => { ({ detail }) => {
const { geometry, properties } = detail; const { feature } = detail;
const { geometry, properties } = feature;
if (geometry) { if (
feature &&
feature.geometry &&
detail.featureCollection == featureCollection
) {
createFeatures({ createFeatures({
features: [{ type: 'Feature', geometry, properties }], features: [{ type: 'Feature', geometry, properties }],
external: true external: true
}); });
} }
}, },
[createFeatures] [createFeatures, featureCollection]
); );
const onFeatureUpdate = useCallback( const onFeatureUpdate = useCallback(

View file

@ -23,7 +23,10 @@ export function PointInput({
}; };
const addPoint = () => { const addPoint = () => {
if (feature) { if (feature) {
fire(document, 'map:feature:create', feature); fire(document, 'map:feature:create', {
feature,
featureCollection
});
setValue(''); setValue('');
setFeature(null); setFeature(null);
} }