-
Notifications
You must be signed in to change notification settings - Fork 168
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
feat: allow disabling validation status change listener registration on binder #14158
feat: allow disabling validation status change listener registration on binder #14158
Conversation
Hi @knoobie, thanks for the contribution. |
@mcollovati Based on my discussion here: vaadin/flow-components#3406 (comment) and my comment here: #13940 (comment) Idea behind this is: first enhancement to allow this change to be toggled by a FeatureFlag. I would love to gradually test this change with multiple applications before I do a big flip on all our forms and applications in a minor release (23.2) and going crazy with problems regarding "not meaningful error messages" and "user has no idea why the field is red". |
@knoobie thanks! Now the context is clear also on the PR |
LGTM, but I would like for one additional review I wonder if it would be good to be able to enable/disable the feature also for a single Binding |
You okay with the name? It was really hard to come up with something.. and even that name feels clumsy..
I had the feeling as well, but wanted to get something out first ;) I had multiple questions as well, but neglected them all in my first throw to make it simple. Should this not stop the listener registration and instead stop the execution of the validate() call.. allowing this to be changed on the fly, instead of only once per binder and so on.. |
I agree that the name feels clumsy. I tried to find an alternative but was unsuccessfully. That's why I would like for another review. |
Interesting point |
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.
@knoobie the whole thing sounds like a good feature! Thanks for the contribution. Just suggested some changes.
flow-data/src/main/java/com/vaadin/flow/data/binder/Binder.java
Outdated
Show resolved
Hide resolved
@@ -1685,6 +1687,8 @@ void setIdentity() { | |||
|
|||
private boolean validatorsDisabled = false; | |||
|
|||
private boolean validationStatusChangeFieldListenerDisabled = false; |
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.
I suggest renaming this field to something like fieldsValidationStatusChangeListenerDisabled
, and also the associated getter/setter/javadocs/tests/etc.
To me, It would sound even better and easier to understand if we negate the name and the default value, e.g. we can call it:
private boolean fieldsValidationStatusChangeListenerEnabled = true;
instead, so that it can be used without a !
.
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.
I can go for the name you prefer :) I used the suffix Disabled
to match with the validatorsDisabled
above to keep the code the same
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.
I noticed the uniformity of naming, but I guess it is better to reduce the negations in naming and also the logic. The other variables also may experience refactoring at some point in the future to simplify the logic ;)
… change listener registration
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Reminder: that the PR description probably has to be updated to something more meaningful, before a release is pushed with this encrypted message |
@taefi I think there should be no need to backport this to other branches, as the |
Hi @knoobie and @taefi, when i performed cherry-pick to this commit to 2.8, i have encountered the following issue. Can you take a look and pick it manually? |
Hi @knoobie and @taefi, 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? |
…on binder (#14158) (CP: 9.0) (#14199) Add binder-level flag to allow disabling of validation status change listener registration for HasValidator fields. Related to #13940 (comment) and #13940 (comment) Co-authored-by: Knoobie <[email protected]> Co-authored-by: Marco Collovati <[email protected]>
Description
Add binder-level flag to allow disabling of
validation status change listener registration
for HasValidator fields.
Related to #13940 (comment) and #13940 (comment)
Type of change
Checklist
Additional for
Feature
type of change