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: #1388 Respect latest field's initial value (esp when its forcefully recreated) #1389

Merged
merged 10 commits into from
Jun 23, 2024

Conversation

nvshah
Copy link
Contributor

@nvshah nvshah commented May 4, 2024

TASK #1388

Connection with issue(s)

Solution description

Always respect latest field's initial value rather than assigning old field's value (if present)

Screenshots or Videos

To Do

  • Read contributing guide
  • Check the original issue to confirm it is fully satisfied
  • Add solution description to help guide reviewers
  • Add unit test to verify new or fixed behaviour
  • If apply, add documentation to code properties and package readme

@deandreamatias
Copy link
Collaborator

Hi! Thanks for contribution!

I updated the build to run with flutter 3.22.
This changes do not pass on test, so is a breaking change compared with current behavior.

Take a look if can change the solution or have some way to pass tests without delete them

@kris175
Copy link

kris175 commented May 31, 2024

Hi, I doubt whether this is the actual root cause or not.

I was able to temporarily fix this issue where the initial value is not being assigned upon reset by reverting to the version 7 which has the same code that is being replaced in this PR, but not in shorthand form.

if (oldField != null) {
      // ignore: invalid_use_of_protected_member
      field.setValue(oldField.value, populateForm: false);
    } else {
      // ignore: invalid_use_of_protected_member
      field.setValue(
        _instantValue[name] ??= field.initialValue,
        populateForm: false,
      );
    }

Therefore it leads me to think it's some other change which is causing this issue and not because of this specific piece of code being changed in the PR.

I will try to compare changes and update if I get time.

@nvshah nvshah changed the title Fix #1388 - Respect latest field's initial value (esp when its forcefully recreated) fix : #1388 - Respect latest field's initial value (esp when its forcefully recreated) Jun 15, 2024
nvshah and others added 2 commits June 15, 2024 13:52
@nvshah
Copy link
Contributor Author

nvshah commented Jun 15, 2024

Updated the PR @deandreamatias

@deandreamatias deandreamatias changed the title fix : #1388 - Respect latest field's initial value (esp when its forcefully recreated) fix: #1388 Respect latest field's initial value (esp when its forcefully recreated) Jun 23, 2024
Copy link

codecov bot commented Jun 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.89%. Comparing base (2771019) to head (8ad740f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1389      +/-   ##
==========================================
+ Coverage   87.85%   87.89%   +0.03%     
==========================================
  Files          21       21              
  Lines         766      768       +2     
==========================================
+ Hits          673      675       +2     
  Misses         93       93              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@deandreamatias deandreamatias merged commit 0262e24 into flutter-form-builder-ecosystem:main Jun 23, 2024
6 of 7 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
Development

Successfully merging this pull request may close these issues.

None yet

3 participants