-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
chore: Avoid Form retrieveSchema twice when liveValidate is true #3959
Conversation
@igorbrasileiro Can you please run |
Sure! Done, thank you for the feedback |
@igorbrasileiro Sorry for the extra work but can your rebase and resolve conflicts? |
Rebased |
@heath-freenome do I have something from my side? Thank you for the attention About the problem, I'm not fully sure if exists this same behavior in other components like array, multischema or object field template. |
I have to approve and merge, which I just did
Retrieve schema has necessary calls in the object field and array field templates |
Reasons for making this change
When utilizing the Form with
liveValidate
, thegetStateFromProps
function triggers theretrieveSchema
function twice. Profiling timings indicate that the retrieveSchema function accounts for approximately 20% (18ms out of 99ms) of the total execution time forgetStateFromProps
.(getStateFromProps from the form first render)
This issue becomes more pronounced, particularly when the form is "controlled" with
liveValidate
. In this scenario, each key press triggers thegetStateFromProps
function, resulting in two calls toretrieveSchema
. Given thatretrieveSchema
consumes more than 20% ofgetStateFromProps
execution time, this pull request addresses the inefficiency by optimizing the retrieval process, ultimately improving the overall performance of the form while typing.Related to #1961
Checklist
npm run test:update
to update snapshots, if needed.