Description
Prerequisites
- I have read the documentation
What theme are you using?
other
Is your feature request related to a problem? Please describe.
The liveValidate
prop performs quite well for one-off state changes in our project when using @rjsf/validator-ajv6
(although not with @rjsf/validator-ajv8
for some reason), but it lags when typing on slow machines.
Describe the solution you'd like
This would seemingly be solved by giving implementator a choice to debounce the validation (so it would only initiate live validation once the user has not typed anything for X milliseconds).
Describe alternatives you've considered
I tried achieving the same effect by turning off liveValidation
and calling a debounced instance of Form.validateForm()
inside onChange
, but it lead to very confusing results for me:
- it appears that
liveValidation
actually functions slightly differently fromForm.validateForm()
in what/how it validates - as ifliveValidation
only validated inputs that were actually being rendered, whileForm.validateForm()
always validating all offormData
against all ofschema
- or something in that ballpark. I was getting very different results between these two, andForm.validateForm()
turned out to be terribly incompatible with our legacy code. Form.validateForm()
triggersonError
, whileliveValidation
doesn't. This is a big issue for us, because we use custom logic for un-collapsing collapsed form sections (custom widgets) and scrolling to invalid fieldsonError
. When usingForm.validateForm()
onChange
to simulate live validation, this makes our form scroll all over the place all the time. De-couplingForm.validateForm()
andonError
(maybe allowing forForm.validateForm({ triggerErrorHandler: false })
) might help our use-case greatly.
It also might be possible to manually achieve this by wrapping @rjsf/validator-ajv6
into a custom validator and using debounce somewhere in the way - but I have no idea how to approach this. Do you think that would be possible?
Thank you for your consideration 🙏