react-hook-form / resolvers

📋 Validation resolvers: Yup, Zod, Superstruct, Joi, Vest, Class Validator, io-ts, Nope, computed-types, typanion, Ajv, TypeBox, ArkType, Valibot, effect-ts and VineJS
https://react-hook-form.com/
MIT License
1.78k stars 162 forks source link

Partial check valibot not returning all errors #716

Open themre opened 1 month ago

themre commented 1 month ago

Describe the bug When using valibot resolver and partialCheck with forward, I do not see all errors that are returned from useForm. Vanilla Valibot however returns all errors. In the provided example I want to see email AND password2 being invalid. RHK returns password2 error only once I fix email. I am using latest libraries.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/p/sandbox/wdxr64?file=%2Fsrc%2FApp.tsx%3A34%2C1
  2. Click on Submit
  3. In the console you will see only email error, where in the log for valibot parseSafe you will see 2 errors.

Codesandbox link (Required) https://codesandbox.io/p/sandbox/wdxr64?file=%2Fsrc%2FApp.tsx%3A34%2C1

Expected behavior 2 errors for email and password2 should be listed.

themre commented 1 month ago

Found out that I need to set additional properties for type of validation in useForm as second argument:

shouldUseNativeValidation: false,
criteriaMode: "all",