-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(module:dropdown): unable to set bool attr to false #8620
Conversation
The issue of not being able to update the value of a `boolean` attribute to **false** externally needs to be corrected.
This preview will be available after the AzureCI is passed. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8620 +/- ##
==========================================
- Coverage 91.51% 91.50% -0.02%
==========================================
Files 534 534
Lines 18425 18425
Branches 2905 2905
==========================================
- Hits 16862 16860 -2
- Misses 1243 1244 +1
- Partials 320 321 +1 ☔ View full report in Codecov by Sentry. |
if (nzVisible !== undefined) { | ||
this.inputVisible$.next(this.nzVisible); | ||
} | ||
if (nzDisabled) { | ||
if (nzDisabled !== undefined) { |
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.
Here, nzVisible and nzDisabled are of type SimpleChange, not boolean. So I guess we don't need to use undefined to determine that, WDYT?
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.
nzVisible
and nzDisabled
receive boolean values externally, but when fetching their values from the changes
object, there can be three possible scenarios: undefined (when the external value has not been changed), true (change to true from false), or false (change to false from true). However, if the code logic is simply if(nzVisible)
, it will only process the case where it is true. When the external source intends to change it to false, it will not take effect as expected.
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 think you misunderstood that when nzDisabled is changed to false, changes.nzDisabled is of type SimpleChange, not boolean, because it's changes.nzDisabled, not this.nzDisabled.
fix(module:dropdown): unable to set bool attr to false
The issue of not being able to update the value of a
boolean
attribute to false externally needs to be corrected.PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information