chore: Form.Item should not support requiredMark #41725
Merged
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
💡 Background and solution
Background:
Solution
修改后
<Form.Item />
将不支持修改requiredMark
属性,只能通过<Form />
的requiredMark
统一设置。📝 Changelog
Form.Item
accidentally overwriting requiredMark logic errorForm.Item
意外覆盖 requiredMark 逻辑问题☑️ Self-Check before Merge
🚀 Summary
🤖 Generated by Copilot at 8cce78b
Refactor the
requiredMark
prop logic in theForm
component and its children. Remove unnecessary props and add test cases and comments to improve the code quality and readability.🔍 Walkthrough
🤖 Generated by Copilot at 8cce78b
requiredMark
prop in theForm
andFormItem
components (link, link, link)requiredMark
prop from theFormItemProps
interface incomponents/form/FormItem/index.tsx
to avoid passing it to theFormItem
component (link)requiredMark
prop from theFormItemLabel
component incomponents/form/FormItem/ItemHolder.tsx
as it is now passed from theForm
component (link)FormItemLabelProps
interface incomponents/form/FormItemLabel.tsx
to explain the internal usage of therequiredMark
prop (link)Form
component incomponents/form/__tests__/index.test.tsx
to verify that therequiredMark
prop works as expected when theForm.Item
component has norequired
prop (link)requiredMark
prop does not render when it is not needed (link)