diff --git a/src/components/forms/validator.js b/src/components/forms/validator.js index 9a8c78fa..514631c6 100644 --- a/src/components/forms/validator.js +++ b/src/components/forms/validator.js @@ -88,7 +88,10 @@ export const uniqueAddress = (addresses: string[] | List) => return addressAlreadyExists ? ADDRESS_REPEATED_ERROR : undefined }) -export const composeValidators = (...validators: Function[]): FieldValidator => (value: Field, values, meta) => { +export const composeValidators = (...validators: Function[]): FieldValidator => (value: Field) => + validators.reduce((error, validator) => error || validator(value), undefined) + +export const composeValidatorsApps = (...validators: Function[]): FieldValidator => (value: Field, values, meta) => { if (!meta.modified) { return } diff --git a/src/routes/safe/components/Apps/ManageApps.js b/src/routes/safe/components/Apps/ManageApps.js index fbacace9..4b0abc9f 100644 --- a/src/routes/safe/components/Apps/ManageApps.js +++ b/src/routes/safe/components/Apps/ManageApps.js @@ -9,7 +9,7 @@ import { getAppInfoFromUrl } from './utils' import Field from '~/components/forms/Field' import DebounceValidationField from '~/components/forms/Field/DebounceValidationField' import GnoForm from '~/components/forms/GnoForm' -import { composeValidators, required } from '~/components/forms/validator' +import { composeValidatorsApps, required } from '~/components/forms/validator' import Img from '~/components/layout/Img' import appsIconSvg from '~/routes/safe/components/Transactions/TxsTable/TxType/assets/appsIcon.svg' @@ -120,7 +120,12 @@ const ManageApps = ({ appList, onAppAdded, onAppToggle }: Props) => { name="appUrl" placeholder="App URL" type="text" - validate={composeValidators(customRequiredValidator, urlValidator, uniqueAppValidator, safeAppValidator)} + validate={composeValidatorsApps( + customRequiredValidator, + urlValidator, + uniqueAppValidator, + safeAppValidator, + )} />