fix(field): #1370 isDirty flag reset on initialValue #1507
fix(field): #1370 isDirty flag reset on initialValue #1507majumdersubhanu wants to merge 6 commits intoflutter-form-builder-ecosystem:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1507 +/- ##
==========================================
- Coverage 90.85% 90.82% -0.04%
==========================================
Files 21 21
Lines 853 861 +8
==========================================
+ Hits 775 782 +7
- Misses 78 79 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes reported isDirty behavior so a field (and thus the form) is no longer considered dirty when its current value matches the configured initialValue, and prevents reset() from triggering recursive onChanged/reset() flows.
Changes:
- Update
FormBuilderFieldStatedirty tracking to deriveisDirtyfromvaluevsinitialValue. - Adjust
reset()ordering to clear dirty before emitting change notifications. - Add widget tests covering “return to initial value” and recursion/overflow scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/src/form_builder_field.dart | Changes dirty calculation and reorders reset() to avoid re-entrant dirty state during callbacks. |
| test/src/form_builder_test.dart | Adds a form-level test verifying FormBuilderState.isDirty clears when user returns to initial value. |
| test/src/form_builder_field_test.dart | Adds field-level tests for isDirty clearing and a regression test intended to cover reset recursion behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@deandreamatias could you please take a look at this PR? |
|
I need a time to take a look deeply on this, because can affect other parts of ecosystem. |
Connection with issue(s)
Close #1370
Solution description
Screenshots or Videos
To Do