Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent reporting of root errors #627

Open
Kirdock opened this issue Sep 4, 2023 · 0 comments
Open

Inconsistent reporting of root errors #627

Kirdock opened this issue Sep 4, 2023 · 0 comments

Comments

@Kirdock
Copy link

Kirdock commented Sep 4, 2023

Describe the bug
Currently, root errors are onChange/append written tomyArray.message and onSubmit written to myArray.root.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/zod-resolver-root-inconsistency-m57c85?file=/src/App.tsx
  2. Click on "Add"
  3. Click on "Add" again
  4. See that the root error is written to formState.errors.people.message
  5. Click on "Submit"
  6. See that the root error is written to formState.errors.people.root.message

Codesandbox link (Required)
https://codesandbox.io/s/zod-resolver-root-inconsistency-m57c85?file=/src/App.tsx

Expected behavior
I would expect that the array errors are always written to myArray.root, no matter if onChange or onSubmit is called.

Versions
react-hook-form: 7.46.0
@hookform/resolvers: 3.3.1

micahjon added a commit to micahjon/rhf-conditional-logic that referenced this issue Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant