You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Only changes to the last field in a field array are considered for validation when using superRefine. Changes to other fields are validated by zodResolver, but the resulting errors are not updated.
To Reproduce
Rule for all scenarios: names must be unique
Scenario 1:
Open sandbox link below
Change second input to "foo" to provoke error
Change first input to "bar" to resolve error
=> zodResolver error disappears, react-hook-form error remains (incorrectly)
Scenario 2:
Open sandbox link below
Change first input to "bar" to provoke error
=> react-hook-form errors are not updatefd (incorrectly)
Scenario 3 (positive):
Open sandbox link below
Change second input to "foo" to provoke error
Change second input back to "bar" to resolve error
=> zodResolver and react-hook-form errors disappear
Expected behavior
zodResolver error states are propagated to the useForm errors regardless of array position
Desktop (please complete the following information):
OS: MacOS
Browser: Brave
Version 1.63.169
Additional context
If the error state is reached by editing the first field (see scenario 2 above), the error from zodResolver is missing the ref object. This seems to be the missing link.
The text was updated successfully, but these errors were encountered:
I have an issue with the resolver incorrectly updating the formState errors with a superRefine.
In the sandbox I created, the rule is that all names should be unique, so it should error on every input that is not unique.
when you click and blur the second input, the error only appears at the second input, but the console shows that the resolver found 2 errors, while the formState errors only gives one (leaves first array index empty), you can see this in the sandbox console and in the image I attached.
Then, when you blur the first input as well, the error appears on both. But when you now change a name so they are unique, only the edited error dissapears, while you expect both to dissapear.
Expected behavior
I expect both errors to appear when they are not unique, and both to dissapear when i change them to be unique.
Describe the bug
Only changes to the last field in a field array are considered for validation when using
superRefine
. Changes to other fields are validated byzodResolver
, but the resultingerrors
are not updated.To Reproduce
Rule for all scenarios: names must be unique
Scenario 1:
=> zodResolver error disappears, react-hook-form error remains (incorrectly)
Scenario 2:
=> react-hook-form errors are not updatefd (incorrectly)
Scenario 3 (positive):
=> zodResolver and react-hook-form errors disappear
Codesandbox link (Required)
Link
Expected behavior
zodResolver error states are propagated to the
useForm
errors regardless of array positionDesktop (please complete the following information):
Additional context
If the error state is reached by editing the first field (see scenario 2 above), the error from zodResolver is missing the
ref
object. This seems to be the missing link.The text was updated successfully, but these errors were encountered: