ng-zorro-antd icon indicating copy to clipboard operation
ng-zorro-antd copied to clipboard

fix(module:avatar): avatar not re-scaling properly

Open ParsaArvanehPA opened this issue 1 year ago • 4 comments

PR Checklist

Please check if your PR fulfills the following requirements:

  • [✔] The commit message follows our guidelines: https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/CONTRIBUTING.md#commit
  • [✔] Tests for the changes have been added (for bug fixes / features)
  • [] Docs have been added / updated (for bug fixes / features)

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?

The scaling of the avatar component was previously performed by a method named notifyCalc. This method used a setTimeout function to delay the scaling function for 4 milliseconds, ensuring that the avatar component was fully rendered and ready to be scaled.

However, this caused a problem when the avatar component was used within components that had opening animation effects, as the avatar component would have an incorrect width. The avatar component required more than 4 milliseconds in these cases to reach its sinalsize, and calling the scaling function, calcStringSize, too early would result in incorrect scale values for the avatar component.

Issue Number: #8363

What is the new behavior?

Calling calcStringSize after avatar component is fully rendered.

Does this PR introduce a breaking change?

[ ] Yes
[✔] No

Other information

ParsaArvanehPA avatar Jan 19 '24 14:01 ParsaArvanehPA

This preview will be available after the AzureCI is passed.

zorro-bot[bot] avatar Jan 19 '24 14:01 zorro-bot[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (6024bcc) 91.74% compared to head (a814b9b) 91.74%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8365   +/-   ##
=======================================
  Coverage   91.74%   91.74%           
=======================================
  Files         520      520           
  Lines       18019    18014    -5     
  Branches     2838     2837    -1     
=======================================
- Hits        16531    16527    -4     
+ Misses       1185     1184    -1     
  Partials      303      303           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 19 '24 14:01 codecov[bot]

@ParsaArvanehPA could you please rebase the branch, to have the fix for the pipeline and then see if all the job passed

Nicoss54 avatar Jan 23 '24 09:01 Nicoss54

@ParsaArvanehPA could you please rebase the branch, to have the fix for the pipeline and then see if all the job passed

@Nicoss54 Yeah sure

ParsaArvanehPA avatar Jan 23 '24 10:01 ParsaArvanehPA