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(Progress): prevent warning when size prop is not set for circle p… #41875

Merged
merged 3 commits into from
May 13, 2023
Merged

Conversation

notzheng
Copy link
Contributor

@notzheng notzheng commented Apr 18, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

None

💡 Background and solution

issue

it will show a warning when size prop is not set for circle progress.

CleanShot 2023-04-19 at 05 00 56@2x

const mergedSize = size ?? [originWidth, originWidth];
const [width, height] = getSize(mergedSize, 'circle');

} else if (type === 'circle' || type === 'dashboard') {
if (typeof size === 'string' || typeof size === 'undefined') {
[width, height] = size === 'small' ? [60, 60] : [120, 120];
} else if (typeof size === 'number') {
[width, height] = [size, size];
} else {
if (process.env.NODE_ENV !== 'production') {
warning(
false,
'Progress',
'Type "circle" and "dashbord" do not accept array as `size`, please use number or preset size instead.',
);
}

solution

set default size to number type.

📝 Changelog

Language Changelog
🇺🇸 English remove unexpected warning on Circle Progress Component
🇨🇳 Chinese 修复 Circle Progress 组件产生错误警告的问题

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

🤖 Generated by Copilot at 5c27763

Simplified the size prop of the Circle component to use a single number instead of an array. This makes the prop more consistent with other Progress components and improves performance and readability.

🔍 Walkthrough

🤖 Generated by Copilot at 5c27763

  • Simplify size prop of Circle component to use a single number instead of an array (link)

@github-actions
Copy link
Contributor

github-actions bot commented Apr 18, 2023

@codecov
Copy link

codecov bot commented Apr 19, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (8200e5c) 100.00% compared to head (b15b9d7) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #41875   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          640       640           
  Lines        10833     10833           
  Branches      2942      2942           
=========================================
  Hits         10833     10833           
Impacted Files Coverage Δ
components/progress/Circle.tsx 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@afc163
Copy link
Member

afc163 commented Apr 23, 2023

补一个用例

@afc163
Copy link
Member

afc163 commented Apr 26, 2023

ping

@notzheng
Copy link
Contributor Author

notzheng commented Apr 26, 2023

ping

pong~ 抱歉来迟了,今天补上。

已添加测试用例,请 Review 一下。@afc163

@li-jia-nan li-jia-nan merged commit f3be5dd into ant-design:master May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants