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

chore: Form.Item should not support requiredMark #41725

Merged
merged 2 commits into from
Apr 10, 2023

Conversation

Wxh16144
Copy link
Member

@Wxh16144 Wxh16144 commented Apr 10, 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

💡 Background and solution

Background:
image

Solution

修改后 <Form.Item /> 将不支持修改 requiredMark 属性,只能通过 <Form />requiredMark 统一设置。

📝 Changelog

Language Changelog
🇺🇸 English fix Form.Item accidentally overwriting requiredMark logic error
🇨🇳 Chinese 修复 Form.Item 意外覆盖 requiredMark 逻辑问题

☑️ 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 8cce78b

Refactor the requiredMark prop logic in the Form 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

  • Refactor the logic of handling the requiredMark prop in the Form and FormItem components (link, link, link)
  • Omit the requiredMark prop from the FormItemProps interface in components/form/FormItem/index.tsx to avoid passing it to the FormItem component (link)
  • Remove the requiredMark prop from the FormItemLabel component in components/form/FormItem/ItemHolder.tsx as it is now passed from the Form component (link)
  • Add a comment to the FormItemLabelProps interface in components/form/FormItemLabel.tsx to explain the internal usage of the requiredMark prop (link)
  • Add a test case to the Form component in components/form/__tests__/index.test.tsx to verify that the requiredMark prop works as expected when the Form.Item component has no required prop (link)
    • Ensure that the requiredMark prop does not render when it is not needed (link)

@github-actions
Copy link
Contributor

github-actions bot commented Apr 10, 2023

@Wxh16144 Wxh16144 changed the title chore: Form.Item does not support requiredMark chore: Form.Item should not support requiredMark Apr 10, 2023
@codecov
Copy link

codecov bot commented Apr 10, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (005db79) 100.00% compared to head (8cce78b) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #41725   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          614       614           
  Lines        10503     10503           
  Branches      2876      2876           
=========================================
  Hits         10503     10503           
Impacted Files Coverage Δ
components/form/FormItem/ItemHolder.tsx 100.00% <ø> (ø)
components/form/FormItem/index.tsx 100.00% <ø> (ø)
components/form/FormItemLabel.tsx 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ 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 10, 2023

解决啥问题,PR 里描述一下?

@zombieJ zombieJ merged commit 0e65dad into ant-design:master Apr 10, 2023
@Wxh16144
Copy link
Member Author

解决啥问题,PR 里描述一下?

好的,已补充~

RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 25, 2023
* test: add case

* chore: Form.Item does not support requiredMark
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 25, 2023
* test: add case

* chore: Form.Item does not support requiredMark
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.

3 participants