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.
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.
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:
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