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(module:dropdown): unable to set bool attr to false #8620

Closed
wants to merge 1 commit into from

Conversation

kerwin612
Copy link

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?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Application (the showcase website) / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

The issue of not being able to update the value of a `boolean` attribute to **false** externally needs to be corrected.
@kerwin612 kerwin612 requested a review from vthinkxie as a code owner July 1, 2024 00:37
Copy link

zorro-bot bot commented Jul 1, 2024

This preview will be available after the AzureCI is passed.

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.50%. Comparing base (beeb52d) to head (393206f).
Report is 3 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

Comment on lines +208 to +211
if (nzVisible !== undefined) {
this.inputVisible$.next(this.nzVisible);
}
if (nzDisabled) {
if (nzDisabled !== undefined) {
Copy link
Collaborator

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?

Copy link
Author

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.

Copy link
Collaborator

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.

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

3 participants