Skip to content

fix(module: select): multiple select cause switch size flash when init - #8851

Merged
Laffery merged 2 commits into
NG-ZORRO:masterfrom
WwwHhhYran:fix/switch_size_flashing_when_used_with_multiple_or_tags_type_select
Nov 7, 2024
Merged

fix(module: select): multiple select cause switch size flash when init#8851
Laffery merged 2 commits into
NG-ZORRO:masterfrom
WwwHhhYran:fix/switch_size_flashing_when_used_with_multiple_or_tags_type_select

Conversation

@WwwHhhYran

@WwwHhhYran WwwHhhYran commented Nov 1, 2024

Copy link
Copy Markdown
Member

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
@zorro-bot

zorro-bot Bot commented Nov 1, 2024

Copy link
Copy Markdown

This preview will be available after the AzureCI is passed.

@codecov

codecov Bot commented Nov 1, 2024

Copy link
Copy Markdown

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.

@Laffery Laffery left a comment

Copy link
Copy Markdown
Collaborator

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

Laffery commented Nov 1, 2024

Copy link
Copy Markdown
Collaborator

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

WwwHhhYran commented Nov 1, 2024

Copy link
Copy Markdown
Member Author

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
Copy Markdown
Member 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 🤝

@WwwHhhYran WwwHhhYran left a comment

Copy link
Copy Markdown
Member Author

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

@Laffery Laffery left a comment

Copy link
Copy Markdown
Collaborator

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
@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