-
-
Notifications
You must be signed in to change notification settings - Fork 200
Closed
Description
Describe the bug
Currently, there is an issue with error handling within useFieldArray, where errors associated with the root error are not functioning as expected.
To Reproduce
Steps to reproduce the behavior:
- Go to Codesandbox
- Click on submit button
- Observe that the error from the second field is displayed under the first field.
Codesandbox link (Required)
Sandbox demonstrating the issue: Codesandbox
Expected behavior
Sandbox with the expected behavior: Codesandbox
Upon investigation, it appears that the issue arises from the removal of empty values within an array before setting errors inside toNestErrors. When used within Object.assign, it results in errors being assigned to incorrect keys.
Versions
react-hook-form: 7.45.2
@hookform/resolvers: 3.3.1
SangJunBak and Yihao-G
Metadata
Metadata
Assignees
Labels
No labels