RFC: new formState isValidating
#3669
Replies: 3 comments 2 replies
-
Like @ArnBZN said on Twitter, with an impact on the size with less than 10% and the complexity is stable, I think this will be a nice addition to the library because it would open more ways to display information to the user specifically with long-running server-side validations. It also enables a more fine-grained control over the state of the form like canceling a submission while it’s validating before mutating the data. Option A to me seems the more consistent approach with other properties available and looks as if it will also be a lesser effort to integrate into the documentation. |
Beta Was this translation helpful? Give feedback.
-
As far as approach goes, since the validation happens at a field level, would it not be appropriate to show this with that field granularity? For example, if you have a username field that needs to check of uniqueness you might want to indicate that next to the field |
Beta Was this translation helpful? Give feedback.
-
Went live with https://github.com/react-hook-form/react-hook-form/releases/tag/v6.14.0 |
Beta Was this translation helpful? Give feedback.
-
Context
React Hook Form validates input async by default, this is great which gives us a lot of flexibility in terms of validation and potentially easily integrates with any server-side validation. However, there is a price to pay that as well which means every action or user interaction will result in async too, right now we are lack of
formState
to support such state update, which appeared on the following feature request:#2841
#3627
Pros
Cons
formState
update is always going to be a global/core update and can't be tree shaken,Proposal
new boolean state
isValidating
Option A
Option B
Implementation
This change will most likely to impact on
useForm
only (with my quick spike). FormState will be guarded with proxy as well, so if you are not reading this state, it will not trigger extra render for your form.Poll result (from the community):
https://twitter.com/HookForm/status/1339155959076122624
There are demands with such form state, but not as popular as other states.
Beta Was this translation helpful? Give feedback.
All reactions