Skip to content

Commit

Permalink
fix: only run validator if using additional geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Apr 4, 2024
1 parent 6cd4f22 commit 4eef2a8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Geometry/GeometryAttributePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const VALIDATOR = (selectedAttributes = []) =>
? i18n.t('One attribute must be selected')
: undefined

const getValidator = (useAttribute) =>
useAttribute ? VALIDATOR : Function.prototype

const HELPTEXT = i18n.t(
'Associated geometry import requires an attribute of type "GeoJSON" applied to "Organisation unit". It can be defined in the Maintenance app.'
)
Expand Down Expand Up @@ -66,7 +69,7 @@ const GeometryAttributePicker = ({
selectedLabel={SELECTEDLABEL}
dataTest={DATATEST}
multiSelect={multiSelect}
validator={VALIDATOR}
validator={getValidator(useAttribute)}
autoSelectFirst
{...rest}
/>
Expand Down

0 comments on commit 4eef2a8

Please sign in to comment.