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(pagination): add cdr check while page index change #6780

Merged
merged 2 commits into from
Jun 17, 2021

Conversation

PeterChen1997
Copy link
Contributor

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?

Can't trigger page index change while the nzPageIndexChange is not set due to the Zone refresh strategy

Issue Number: 6661
#6661

What is the new behavior?

Trigger change after emit the output function

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@zorro-bot
Copy link

zorro-bot bot commented Jun 16, 2021

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Jun 16, 2021

Codecov Report

Merging #6780 (3ce8abd) into master (923f14e) will decrease coverage by 0.14%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6780      +/-   ##
==========================================
- Coverage   89.70%   89.56%   -0.15%     
==========================================
  Files         486      488       +2     
  Lines       15757    15778      +21     
  Branches     2564     2568       +4     
==========================================
- Hits        14135    14131       -4     
- Misses        980     1005      +25     
  Partials      642      642              
Impacted Files Coverage Δ
components/pagination/pagination.component.ts 98.80% <100.00%> (+0.02%) ⬆️
components/table/src/table/tr-measure.component.ts 86.95% <0.00%> (-13.05%) ⬇️
components/table/src/table/tbody.component.ts 88.88% <0.00%> (-11.12%) ⬇️
components/core/config/config.service.ts 91.17% <0.00%> (-5.89%) ⬇️
...onents/table/src/addon/filter-trigger.component.ts 40.90% <0.00%> (-2.57%) ⬇️
components/tabs/tab-nav-bar.component.ts 81.62% <0.00%> (-1.42%) ⬇️
components/select/select.component.ts 87.22% <0.00%> (-0.05%) ⬇️
components/select/option.component.ts 100.00% <0.00%> (ø)
...s/core/resize-observers/resize-observers.module.ts
.../core/resize-observers/resize-observers.service.ts
... and 5 more

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 923f14e...3ce8abd. Read the comment docs.

@PeterChen1997
Copy link
Contributor Author

@@ -132,6 +132,7 @@ export class NzPaginationComponent implements OnInit, OnDestroy, OnChanges {
if (validIndex !== this.nzPageIndex && !this.nzDisabled) {
this.nzPageIndex = validIndex;
this.nzPageIndexChange.emit(this.nzPageIndex);
this.cdr.markForCheck();
Copy link
Member

Choose a reason for hiding this comment

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

Hi, @PeterChen1997 感谢你的贡献,虽然这里的 markForCheck() 在这里没有其它副作用,但是我觉得在 L:150 行调用意图更明显一点。

Promise.resolve().then(() => {
  this.onPageIndexChange(lastIndex);
  this.cdr.markForCheck();
});

Copy link
Member

@hsuanxyz hsuanxyz left a comment

Choose a reason for hiding this comment

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

LGTM

@hsuanxyz hsuanxyz merged commit 2f1f8dc into NG-ZORRO:master Jun 17, 2021
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.

2 participants