Skip to content

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

Merged
bluebill1049 merged 3 commits intoreact-hook-form:masterfrom
newsiberian:improve-executeBuiltInValidation
Jul 5, 2024
Merged

fix: skip call executeBuiltInValidation if no sub-fields left#12054
bluebill1049 merged 3 commits intoreact-hook-form:masterfrom
newsiberian:improve-executeBuiltInValidation

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

@newsiberian newsiberian requested a review from bluebill1049 June 27, 2024 07:13
@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
@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