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

perf(module:icon): do not run change detection when changing icon #7071

Merged
merged 2 commits into from
Dec 16, 2021

Conversation

arturovt
Copy link
Member

PR Checklist

PR Type

[x] Refactoring (no functional changes, no api changes)

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@zorro-bot
Copy link

zorro-bot bot commented Nov 16, 2021

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Nov 16, 2021

Codecov Report

Merging #7071 (9e5d6e4) into master (d45f0ab) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7071      +/-   ##
==========================================
- Coverage   89.57%   89.54%   -0.03%     
==========================================
  Files         488      488              
  Lines       15821    15826       +5     
  Branches     2440     2440              
==========================================
+ Hits        14171    14172       +1     
- Misses       1009     1011       +2     
- Partials      641      643       +2     
Impacted Files Coverage Δ
components/menu/submenu.component.ts 98.93% <ø> (-0.02%) ⬇️
components/icon/icon.directive.ts 95.58% <100.00%> (+0.42%) ⬆️
...ponents/menu/submenu-non-inline-child.component.ts 81.08% <0.00%> (-2.71%) ⬇️
components/tabs/tab-nav-bar.component.ts 81.56% <0.00%> (-1.42%) ⬇️
components/time-picker/time-holder.ts 95.78% <0.00%> (-1.06%) ⬇️
components/core/util/text-measure.ts 91.22% <0.00%> (+1.75%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d45f0ab...9e5d6e4. Read the comment docs.

@wzhudev
Copy link
Member

wzhudev commented Nov 17, 2021

Hi! Some tests seemed failed to pass. Could you please take a look at it?

Many thanks for this PR and your continuous contributions to ng-zorro-antd!

@arturovt
Copy link
Member Author

Hey, I had to update the components/menu/submenu.component.ts and remove markForCheck() there because it was breaking tests.

Basically, the markForCheck() is not needed there. The onPositionChange is used within the template (positionChange)="onPositionChange($event)" and template event handlers already call markForCheck() internally.

Tests were affected by this change because the [nz-icon] directive is used within menu.spec.ts tests. The changeIcon() promise triggered multiple change detections, and the onPositionChange was called numerous times, reverting the position value.

Copy link
Member

@simplejason simplejason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@simplejason simplejason merged commit e998e4a into NG-ZORRO:master Dec 16, 2021
qugemingzizhenmafan pushed a commit to qugemingzizhenmafan/ng-zorro-antd that referenced this pull request Dec 17, 2021
…-ZORRO#7071)

* perf(module:icon): do not run change detection when changing icon

* fix: do not run `markForCheck()` for the view event handler
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.

3 participants