Replies: 1 comment
-
I saw other issues like #778 (comment) and assumed it would work for my use case. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version Number
7.53.0
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/q8y6fm
Steps to reproduce
Error array is not up to date / using old state.
The input fields min, nominal and max input values can not be validated on their own but are dependent on each other.
All three need to be revalidated if any of the three change.
To acquire the value of the min, nominal and max properties,
watch
is used.The revalidation is triggered manually by using the trigger function in the
useEffect
hook.Problem:
watch
values are up to date but the error array is not!example:
with const errors = formErrors;
input min = 10, nominal = 20, max = 30 in this order
watch says min = 10, nominal = 20 and max = 30
the error array is still lacking one step behind and uses the values
min = 10, nominal = 20 and max = 3
with const errors = formStateErrors;
input min = 1, nominal = 10, max = 10 in this order
the error array is still lacking one step behind and uses the values
min = 1, nominal = 10 and max = 1
Once you for example add another character like . or another digit, it will be reevaluated.
Expected behaviour
Error object should not lag one step behind and should be updated when trigger is called so it is always up to date.
What browsers are you seeing the problem on?
Edge
Relevant log output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions