-
-
Notifications
You must be signed in to change notification settings - Fork 969
fix(Form): call onChange when reset() is invoked on controlled form #4444
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
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4444 +/- ##
==========================================
+ Coverage 94.47% 94.49% +0.01%
==========================================
Files 559 559
Lines 13740 13795 +55
Branches 4081 4106 +25
==========================================
+ Hits 12981 13035 +54
- Misses 687 688 +1
Partials 72 72
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 fixes a bug where the onChange callback was not being invoked when the reset() method is called on a controlled form. The fix ensures that parent components can properly track form state changes when a reset occurs.
Key Changes:
- Added
onChangecallback invocation in thereset()method when form is reset to default values - Added comprehensive test coverage for this behavior with controlled forms
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Form/Form.tsx | Modified the reset() method to call onChange with the reset value before calling onReset, ensuring controlled forms properly notify parent components of state changes |
| src/Form/test/Form.spec.tsx | Added new test case and imported necessary testing utilities (vi, FormInstance) to verify onChange is called when reset() is invoked on a controlled form |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fix: #4394