Skip to content

issue: Incorrect error reporting when using resolvers #10882

@Kirdock

Description

@Kirdock

Version Number

7.46.0

Codesandbox/Expo snack

https://codesandbox.io/s/resolver-validation-bug-qjq7kk?file=/src/App.tsx

Steps to reproduce

  1. Go to https://codesandbox.io/s/resolver-validation-bug-qjq7kk?file=/src/App.tsx
  2. Click on "Add" in the "With Resolvers" form
  3. See that the required error is shown
  4. Click "Add" again
  5. See that the required errors are missing now
  6. Click on "Submit" and "Add"
  7. See that field errors are reset

Video:

resolver.mp4

I'm actually showing more than one error in this video.

  1. Probably related to issue: field-array-level validation errors not sent to the formState when blurring array items' inputs #10776.
  2. On field add, the validation is immediately triggered, when using resolvers. This does not happen if plain rules are used instead.
  3. If a fieldArray/root error comes in, each field error is reset. You can see that the required errors are lost once the root error comes in.
  4. (Maybe related to 3.) Field errors are cleared when the form is submitted and afterwards a new field is added.

Expected behaviour

  1. On field edit, the error of the fieldArray should be updated
  2. When using resolvers, adding fields don't immediately trigger the validation
  3. FieldArray errors don't reset the field errors
  4. Adding fields doesn't reset field errors after submit

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions