@@ -50,6 +50,7 @@ import {
50 buildEmailValidator,
50 buildEmailValidator,
51 composeValidator,
51 composeValidator,
52 hasErrors,
52 hasErrors,
53} from 'form/validators';
54} from 'form/validators';
54import { FORM_ERROR } from 'final-form';
55import { FORM_ERROR } from 'final-form';
55import SubmitButton from 'form/SubmitButton';
56import SubmitButton from 'form/SubmitButton';
@@ -98,8 +99,6 @@ const buildAccessoryFor = (dones, errors) => name => {
98 return <AccessoryIcon.Pending />;
99 return <AccessoryIcon.Pending />;
101−const emailFormatValidator = buildEmailValidator();
103export default function InviteEmail() {
102export default function InviteEmail() {
104 const { contracts, web3, networkType } = useNetwork();
103 const { contracts, web3, networkType } = useNetwork();
105 const { wallet, walletType, walletHdPath } = useWallet();
104 const { wallet, walletType, walletHdPath } = useWallet();
@@ -135,14 +134,8 @@ export default function InviteEmail() {
135 const isFailed = status === STATUS.FAILURE;
134 const isFailed = status === STATUS.FAILURE;
136 const isDone = status === STATUS.SUCCESS;
135 const isDone = status === STATUS.SUCCESS;
138− const validateEmail = useCallback(
137+ const validateHasReceived = useCallback(
139 async email => {
138 async email => {
140− // check individual email validity
141− const error = await emailFormatValidator(email);
146 const hasReceived = await getHasReceived(email);
139 const hasReceived = await getHasReceived(email);
147 if (hasReceived) {
140 if (hasReceived) {
148 return HAS_RECEIVED_TEXT;
141 return HAS_RECEIVED_TEXT;
@@ -151,11 +144,6 @@ export default function InviteEmail() {
151 [getHasReceived]
144 [getHasReceived]
154− const validateEmails = useCallback(
155− async emails => await Promise.all(emails.map(validateEmail)),
159 const validateForm = useCallback(async (values, errors) => {
147 const validateForm = useCallback(async (values, errors) => {
160 if (hasErrors(errors)) {
148 if (hasErrors(errors)) {
161 return errors;
149 return errors;
@@ -169,8 +157,16 @@ export default function InviteEmail() {
171 const validate = useMemo(
159 const validate = useMemo(
172− () => composeValidator({ emails: validateEmails }, validateForm),
161+ composeValidator(
173− [validateEmails, validateForm]
162+ {
163+ emails: buildArrayValidator(
164+ buildEmailValidator([validateHasReceived])
169+ [validateForm, validateHasReceived]
176 // progress is [0, .length] of invites or receipts, as we're generating them
172 // progress is [0, .length] of invites or receipts, as we're generating them