-
-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is there throttling on validateField #1724
Comments
The throttle code is necessary, since validation triggers reactivity a lot, especially if you have many reactive fields. We could, however introduce an API, where you set a different throttling speed or disable throttle at all, if that would help you. If you use simple schema, you could also do manual validation this way: const { insertDoc } = AutoForm.getFormValues(formId)
const context = formSchema.newContext() // formSchema is the schema you use for this form
context.validate(formDoc, options) // options is optional but can be useful, like clean options
const errors = context.validationErrors()
if (errors && errors.length > 0) {
errors.forEach(err => AutoForm.addStickyValidationError(formId, err.key, err.type, err.value))
return // form is invalid
}
// otherwise remove sticky validation errors and continue with insert doc |
Ok, I understand and thanks for the workaround. |
I have a big schema and has splitted the form in parts for easier fill in/overview. That means that I cannot use validateForm, but instead validate each field.
I do (basically) :
This works well if I step through it in the debugger, but when run normally, validateField returns true whatever the reality is.
Am I missing some logic here? Why is the throttle there? Is my approach unique and wrong?
From the package code:
The text was updated successfully, but these errors were encountered: