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: select): multiple select cause switch size flash when init #8851

Conversation

WwwHhhYran
Copy link
Contributor

@WwwHhhYran WwwHhhYran commented Nov 1, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • 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: Close #8847

What is the new behavior?

当 select 的 nzMode 设为 multiple 或 tags 且 switch 的 nzSize 设为 small 时,switch 组件初始化时不再出现大小闪烁现象(由 default 变为 small)

When nzMode of select is multiple or tags, and nzSize of switch is small, the size flashing (change from default to small) of switch no longer occurs at initialization.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@WwwHhhYran WwwHhhYran requested a review from vthinkxie as a code owner November 1, 2024 03:04
Copy link

zorro-bot bot commented Nov 1, 2024

This preview will be available after the AzureCI is passed.

Copy link

codecov bot commented Nov 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.93%. Comparing base (79e8d5a) to head (73a8697).
Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8851      +/-   ##
==========================================
- Coverage   91.94%   91.93%   -0.01%     
==========================================
  Files         537      537              
  Lines       18455    18458       +3     
  Branches     2816     2816              
==========================================
+ Hits        16968    16970       +2     
- Misses       1183     1184       +1     
  Partials      304      304              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@Laffery Laffery left a comment

Choose a reason for hiding this comment

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

Hi there 👋, thanks for your first contribution to ng-zorro !

What about wrapping the regAnimFrame in the syncMirrorWidth method instead?

syncMirrorWidth(): void {
	reqAnimFrame(() => {
		// ...
	});
}

@Laffery
Copy link
Collaborator

Laffery commented Nov 1, 2024

Further more, even though we have encapsulated the reqAnimFrame method to polyfill requestAnimationFrame in various browser, there are only a few of components had taken advantage of this method.
It would be great to pull a request to upgrade these usage for reqAnimFrame if you like !

@WwwHhhYran
Copy link
Contributor Author

WwwHhhYran commented Nov 1, 2024

Hi there 👋, thanks for your first contribution to ng-zorro !

What about wrapping the regAnimFrame in the syncMirrorWidth method instead?

syncMirrorWidth(): void {
	reqAnimFrame(() => {
		// ...
	});
}

Thank you for your suggestion. Obviously, this is a more elegant way of coding. I have made the necessary modifications, thanks very much ! @Laffery

@WwwHhhYran
Copy link
Contributor Author

Further more, even though we have encapsulated the reqAnimFrame method to polyfill requestAnimationFrame in various browser, there are only a few of components had taken advantage of this method. It would be great to pull a request to upgrade these usage for reqAnimFrame if you like !

I'm willing and will try my best to do that 🤝

Copy link
Contributor Author

@WwwHhhYran WwwHhhYran left a comment

Choose a reason for hiding this comment

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

done

@WwwHhhYran WwwHhhYran requested a review from Laffery November 7, 2024 02:38
Copy link
Collaborator

@Laffery Laffery left a comment

Choose a reason for hiding this comment

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

LGTM

@Laffery Laffery merged commit d28876c into NG-ZORRO:master Nov 7, 2024
9 of 10 checks passed
@WwwHhhYran WwwHhhYran deleted the fix/switch_size_flashing_when_used_with_multiple_or_tags_type_select branch November 13, 2024 04:05
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.

nz-switch: sizing issue when used with nz-select
2 participants