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

fix: skip call executeBuiltInValidation if no sub-fields left #12054

Conversation

newsiberian
Copy link
Contributor

We've had a performance issue with useFieldArray and too many rows with validated fields. I've noticed that with function do some extra recursion with empty an fieldValue which mostly the reason of our issues

@bluebill1049
Copy link
Member

thanks, could you plz add a test case for this as well? so it validates a correct ussecase.

@newsiberian
Copy link
Contributor Author

Sure! I'm a bit busy atm. Will try to add tests during the next week

@newsiberian
Copy link
Contributor Author

@bluebill1049 done. Please, check. Kinda looks strange, but I was unable to directly mock executeBuiltInValidation and that's the way that came into my mind.

@bluebill1049 bluebill1049 changed the title fix: don't call executeBuiltInValidation if no sub-fields left fix: skip call executeBuiltInValidation if no sub-fields left Jul 5, 2024
@bluebill1049 bluebill1049 merged commit 0e8710a into react-hook-form:master Jul 5, 2024
6 checks passed
@bluebill1049
Copy link
Member

thanks for the improvement.

oskarski pushed a commit to oskarski/react-hook-form that referenced this pull request Oct 1, 2024
…act-hook-form#12054)

* fix: don't call `executeBuiltInValidation` if no sub-fields left

* refactor: use `isEmptyObject`

* chore: add tests to check the correct number of times `executeBuiltInValidation` called
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants