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: error reported when the name of Form.List is 0 #43199

Merged
merged 2 commits into from Jun 28, 2023

Conversation

Yuiai01
Copy link
Contributor

@Yuiai01 Yuiai01 commented Jun 26, 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

close #43195

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fixed an error when Form.list name was 0
🇨🇳 Chinese 修复 Form.list 的 name 为 0 时报错

☑️ 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 12c6fff

Fixed a bug in Form.List that prevented using 0 as a name prop, and added a test case to ensure the fix works. This improves the usability and reliability of the Form.List component.

🔍 Walkthrough

🤖 Generated by Copilot at 12c6fff

  • Allow 0 as a valid value for the name prop of Form.List to fix a bug with array indexes (link, link)
  • Adjust the import order of modules in FormList.tsx to follow the convention of external before internal (link)

@github-actions
Copy link
Contributor

github-actions bot commented Jun 26, 2023

@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (cb1abcf) 100.00% compared to head (be77ee5) 100.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##            master    #43199     +/-   ##
===========================================
  Coverage   100.00%   100.00%             
===========================================
  Files          656       648      -8     
  Lines        11967     10965   -1002     
  Branches      3401      2978    -423     
===========================================
- Hits         11967     10965   -1002     
Impacted Files Coverage Δ
components/form/FormList.tsx 100.00% <100.00%> (ø)

... and 51 files with indirect coverage changes

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

@@ -35,7 +35,7 @@ const FormList: React.FC<FormListProps> = ({
children,
...props
}) => {
warning(!!props.name, 'Form.List', 'Miss `name` prop.');
warning(typeof props.name === 'number' || !!props.name.length, 'Form.List', 'Miss `name` prop.');
Copy link
Member

Choose a reason for hiding this comment

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

等等,如果写了 name={null} 这里会报错

@zombieJ zombieJ merged commit c3225c0 into ant-design:master Jun 28, 2023
52 checks passed
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.

console.error: "Warning: [antd: Form.List] Miss name prop." in nested list
3 participants