Skip to content

Comments

🔬 test: add regression tests for #12837 and #13136#13187

Merged
bluebill1049 merged 3 commits intoreact-hook-form:masterfrom
hlongc:test/regression-tests-12837-13136
Dec 12, 2025
Merged

🔬 test: add regression tests for #12837 and #13136#13187
bluebill1049 merged 3 commits intoreact-hook-form:masterfrom
hlongc:test/regression-tests-12837-13136

Conversation

@hlongc
Copy link
Contributor

@hlongc hlongc commented Dec 9, 2025

Add regression tests for #12837 and #13136

I saw these two issues were already fixed but didn't have specific tests covering the exact scenarios, so I added some to prevent regressions.

What's included

#12837 - isDirty not updating after reset with useFieldArray
The bug happened when using useFormState subscription with fieldArray operations after a reset. Added test to cover this.

#13136 - React warning when adding multiple fields with async validation
Race condition between validation and rendering caused "Cannot update component while rendering" errors. Test ensures this doesn't happen anymore.

Both issues were fixed in recent commits (particularly #13181), these tests just document the specific user scenarios and prevent them from breaking again.


Closes #12837
Closes #13136

@hlongc hlongc force-pushed the test/regression-tests-12837-13136 branch 3 times, most recently from afe9b49 to 9f6366e Compare December 9, 2025 12:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds regression tests for two previously fixed issues to prevent future breakage. The tests document specific user scenarios that were causing problems.

Key Changes:

  • Added test for isDirty state tracking with useFieldArray operations after reset (#12837)
  • Added test to verify no React rendering errors occur when adding multiple fields with async validation (#13136)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/tests/useFieldArray.test.tsx Adds test verifying isDirty correctly updates after reset when using fieldArray operations with useFormState subscription
src/tests/useForm/resolver.test.tsx Adds test ensuring no "Cannot update component while rendering" errors occur when combining fieldArray, async validation, and reset operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hlongc hlongc force-pushed the test/regression-tests-12837-13136 branch from 9f6366e to 8ab7349 Compare December 10, 2025 03:48
@hlongc hlongc force-pushed the test/regression-tests-12837-13136 branch from 8ab7349 to 1907169 Compare December 10, 2025 04:39
@bluebill1049 bluebill1049 merged commit 0676cc7 into react-hook-form:master Dec 12, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants