movpushmov / effector-reform

make & use forms without a headache
https://movpushmov.dev/effector-reform/
MIT License
19 stars 3 forks source link

Zod errors, no matter what applies only last error from zod schema #22

Closed At-Sky closed 2 months ago

At-Sky commented 2 months ago
const $$form= createForm({
  schema: {
    email: createField<string>("", { clearOuterErrorOnChange: true }),
  },
  validation: zodAdapter(
    z.object({
      email: z.string().min(1, "Required").email("InvalidEmail"),
    }),
  ),
  validationStrategies: ["blur"],
});

debug($$form.$errors) => {email: 'InvalidEmail'} 
even empty field triggers "InvalidEmail" error