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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportPatch coverage:
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
☔ View full report in Codecov by Sentry. |
afc163
reviewed
Jun 26, 2023
afc163
reviewed
Jun 26, 2023
zombieJ
reviewed
Jun 27, 2023
zombieJ
approved these changes
Jun 27, 2023
zombieJ
reviewed
Jun 27, 2023
components/form/FormList.tsx
Outdated
@@ -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.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
等等,如果写了 name={null}
这里会报错
zombieJ
approved these changes
Jun 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
close #43195
💡 Background and solution
📝 Changelog
Form.list
name was 0Form.list
的 name 为 0 时报错☑️ Self-Check before Merge
🚀 Summary
🤖 Generated by Copilot at 12c6fff
Fixed a bug in
Form.List
that prevented using0
as a name prop, and added a test case to ensure the fix works. This improves the usability and reliability of theForm.List
component.🔍 Walkthrough
🤖 Generated by Copilot at 12c6fff
0
as a valid value for thename
prop ofForm.List
to fix a bug with array indexes (link, link)FormList.tsx
to follow the convention of external before internal (link)