Skip to content
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

perf: skips field validations until the form is submitted #10580

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jacobsfletch
Copy link
Member

Field validations can be expensive, especially custom validations that are async or highly complex. This can lead to slow form state response times when many when generating form state for many such fields. Ideally, we only run validations on fields whose values have changed. This is not possible, however, because field validation functions might reference other field values with their args, and there is no good way of detecting exactly which fields should run in this case. The next best thing here is to only run validations after the form has been submitted, and then every onChange event thereafter. This is possible because we currently don't render field errors until this condition is met anyway. This change will significantly speed up form state response times, at least until the form has been submitted. From then on, all field validations will run regardless, just as they do now.

@jacobsfletch jacobsfletch requested a review from denolfe as a code owner January 14, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant