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: Clear changed bindings after initing field values #12181

Merged
merged 4 commits into from
Nov 9, 2021

Conversation

TatuLund
Copy link
Contributor

@TatuLund TatuLund commented Oct 27, 2021

JavaDoc of hasChanges says

"Check whether any of the bound fields' have uncommitted changes since last explicit call to {@link #readBean(Object)}, {@link #removeBean()}, * {@link #writeBean(Object)} or {@link #writeBeanIfValid(Object)}."

If readBean has converters, they will be run and field values updated accordingly. Furthermore if fields have value change listeners that will produce further changes in values, this should be considered according to above as part of readBean producedure and thus hasChanges still should return false.

Cherry pick from: vaadin/framework#12455

@knoobie
Copy link
Contributor

knoobie commented Oct 27, 2021

Totally random: Do you plan to forward port vaadin/framework#12360 as well?

@vaadin-bot
Copy link
Collaborator

SonarQube analysis reported 8 issues

  1. MAJOR Binder.java#L945: Rename "binding" which hides the field declared at line 899. rule
  2. MAJOR Binder.java#L1018: Rename "binding" which hides the field declared at line 899. rule
  3. MINOR Binder.java#L246: "public" is redundant in this context. rule
  4. MINOR Binder.java#L253: "public" is redundant in this context. rule
  5. MINOR Binder.java#L1954: Rename this generic name to match the regular expression '^[A-Z][0-9]?$'. rule
  6. MINOR Binder.java#L2026: Rename this generic name to match the regular expression '^[A-Z][0-9]?$'. rule
  7. INFO Binder.java#L2809: Complete the task associated to this TODO comment. rule
  8. INFO Binder.java#L2823: Complete the task associated to this TODO comment. rule

@TatuLund
Copy link
Contributor Author

Totally random: Do you plan to forward port vaadin/framework#12360 as well?

@knoobie Here you go: #12183

@TatuLund TatuLund changed the title Clear changed bindings after initing field values fix: Clear changed bindings after initing field values Oct 27, 2021
@mshabarov mshabarov requested review from mshabarov and anssit and removed request for mshabarov November 1, 2021 12:16
@anssit anssit merged commit 4e36fd9 into master Nov 9, 2021
@anssit anssit deleted the fix-binder-haschanges branch November 9, 2021 08:08
@vaadin-bot
Copy link
Collaborator

Hi @TatuLund and @anssit, when i performed cherry-pick to this commit to 8.0, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick 4e36fd9
error: could not apply 4e36fd9... fix: Ensure that side effects of readBean do not set hasChanges true (#12181)
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add ' or 'git rm '
hint: and commit the result with 'git commit'

@vaadin-bot
Copy link
Collaborator

Hi @TatuLund and @anssit, when i performed cherry-pick to this commit to 2.7, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick 4e36fd9
error: could not apply 4e36fd9... fix: Ensure that side effects of readBean do not set hasChanges true (#12181)
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add ' or 'git rm '
hint: and commit the result with 'git commit'

anssit pushed a commit that referenced this pull request Nov 9, 2021
…12181)

JavaDoc of hasChanges says:

"Check whether any of the bound fields' have uncommitted changes
since last explicit call to readBean(Object), removeBean(), writeBean(Object)}
or writeBeanIfValid(Object)."

If readBean has converters, they will be run and field values updated accordingly.
Furthermore if fields have value change listeners that will produce further
changes in values, this should be considered according to above as part of
readBean procedure and thus hasChanges still should return false.

Cherry pick from: vaadin/framework#12455

(cherry picked from commit 4e36fd9)
joheriks pushed a commit that referenced this pull request Nov 9, 2021
…12181) (#12317)

JavaDoc of hasChanges says:

"Check whether any of the bound fields' have uncommitted changes
since last explicit call to readBean(Object), removeBean(), writeBean(Object)}
or writeBeanIfValid(Object)."

If readBean has converters, they will be run and field values updated accordingly.
Furthermore if fields have value change listeners that will produce further
changes in values, this should be considered according to above as part of
readBean procedure and thus hasChanges still should return false.

Cherry pick from: vaadin/framework#12455

(cherry picked from commit 4e36fd9)

Co-authored-by: Tatu Lund <tatu@vaadin.com>
anssit pushed a commit that referenced this pull request Nov 9, 2021
…12181)

JavaDoc of hasChanges says:

"Check whether any of the bound fields' have uncommitted changes
since last explicit call to readBean(Object), removeBean(), writeBean(Object)}
or writeBeanIfValid(Object)."

If readBean has converters, they will be run and field values updated accordingly.
Furthermore if fields have value change listeners that will produce further
changes in values, this should be considered according to above as part of
readBean procedure and thus hasChanges still should return false.

Cherry pick from: vaadin/framework#12455

(cherry picked from commit 4e36fd9)
joheriks pushed a commit that referenced this pull request Nov 9, 2021
…12181) (#12319)

JavaDoc of hasChanges says:

"Check whether any of the bound fields' have uncommitted changes
since last explicit call to readBean(Object), removeBean(), writeBean(Object)}
or writeBeanIfValid(Object)."

If readBean has converters, they will be run and field values updated accordingly.
Furthermore if fields have value change listeners that will produce further
changes in values, this should be considered according to above as part of
readBean procedure and thus hasChanges still should return false.

Cherry pick from: vaadin/framework#12455

(cherry picked from commit 4e36fd9)

Co-authored-by: Tatu Lund <tatu@vaadin.com>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with platform 22.0.0.beta2 and is also targeting the upcoming stable 22.0.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants