undefined field.state.meta.errors
For some reason one field of my form is initializing with an undefined field.state.meta.errors. I'm not using form.setFieldMeta on this field. I checked the types, I checked the initial values. Any clues of what could possibly cause this?
Below are two components of the form:
<form.Field
name="condoCreate.address.zipcode"
validators={{
onChange: ({ value }) => (!value ? "Obrigatório" : undefined),
}}
children={(field) => {
return (
<Input
id={field.name}
name={field.name}
value={field.state.value}
error={field.state.meta.errors?.join(", ")}
onChange={(val) => {
field.handleChange(applyZipcodeMask(val));
}}
label="CEP (Condomínio) *"
/>
);
}}
/>
<form.Field
name="condoCreate.address.number"
validators={{
onChange: ({ value }) => (!value ? "Obrigatório" : undefined),
}}
children={(field) => {
return (
<Input
id={field.name}
name={field.name}
value={field.state.value}
error={field.state.meta.errors.join(", ")}
onChange={(val) => {
field.handleChange(val);
}}
label="Número (Condomínio) *"
/>
);
}}
/>
condoCreate.address.zipcode is the one with problem. All other fields are normal. Even if i change zipcode for some non-existing field it initializes correctly with field.state.meta.errors = []
0 Replies