Replies: 2 comments 2 replies
-
Please, refer to #8170 for the API design reasoning.
The React way would be to call the |
Beta Was this translation helpful? Give feedback.
0 replies
-
@Moshyfawn thanks for the clarifications. Are you referring to the individual fields |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Version Number
7.45.3
Codesandbox/Expo snack
https://codesandbox.io/s/stale-formstate-error-v2qjqd
Steps to reproduce
Sum with B must be 10 (1)
onBlur
Sum with A must be 10 (2)
Sum with A must be 10 (3)
/Sum with B must be 10 (3)
. [Expected]setError
on both text fields.Error for A
/Error for B
. [Expected]Expected behaviour
The form validation
mode
is set toonBlur
.As the error state for both inputs are subscribed, it seemed that errors set using the resolver doesn't trigger an update as seen in step 2 and step 5.
I would expect Step 2 to see error message (
Sum with A must be 10 (1)
) for second text field and Step 5 to see updated error message (Sum with B must be 10 (2)
) for first text fieldBoth errors are updated only when
methods.trigger
orsetError
s are called in step 6 and 8 respectively.P.S. Behavior is similar if mode is set to
onChange
orall
.My actual use case requires complex validation dependencies using controlled input implemented using
useController
, so I cannot usedeps
option inregister
. One solution is to watch all values and callmethods.trigger
when the values are change. Is that the most optimal way?What browsers are you seeing the problem on?
No response
Relevant log output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions