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: fix error when component === false #45671

Merged
merged 2 commits into from
Nov 5, 2023
Merged

fix: fix error when component === false #45671

merged 2 commits into from
Nov 5, 2023

Conversation

li-jia-nan
Copy link
Member

@li-jia-nan li-jia-nan commented Nov 4, 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

📝 Changelog

Language Changelog
🇺🇸 English fix: fix error when component === false
🇨🇳 Chinese -

☑️ 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 f8cb9e6

This pull request improves the test coverage and robustness of the app component. It adds a new test case for when the appConfig prop is false, and modifies the components/app/index.tsx file to handle this scenario correctly.

🔍 Walkthrough

🤖 Generated by Copilot at f8cb9e6

  • Add and modify test cases for the app component in components/app/__tests__/index.test.tsx (link, link, link)
  • Mock console.error to suppress warnings (link)
  • Assert that no warnings and no ant-app class are rendered when appConfig is false (link)
  • Restore console.error after the test (link)
  • Pass undefined as rootProps when component is false (link)

Copy link

stackblitz bot commented Nov 4, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

github-actions bot commented Nov 4, 2023

Preview Is ready

Copy link
Contributor

github-actions bot commented Nov 4, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 400.49 KB (+5 B 🔺)
./dist/antd-with-locales.min.js 459.82 KB (+4 B 🔺)

Copy link

argos-ci bot commented Nov 4, 2023

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No change detected - Nov 4, 2023, 11:31 AM

Copy link

codecov bot commented Nov 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d1ed469) 100.00% compared to head (4844f05) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #45671   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          699       699           
  Lines        11815     11816    +1     
  Branches      3150      3151    +1     
=========================================
+ Hits         11815     11816    +1     
Files Coverage Δ
components/app/index.tsx 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@crazyair
Copy link
Member

crazyair commented Nov 4, 2023

奇怪,这个如果传了 false 有报错吗 https://github.com/react-component/field-form/blob/master/src/Form.tsx

@li-jia-nan
Copy link
Member Author

奇怪,这个如果传了 false 有报错吗 https://github.com/react-component/field-form/blob/master/src/Form.tsx

没懂,这里传了 false 只是隐藏了dom,跟 rc-form 有啥关系吗?

@crazyair
Copy link
Member

crazyair commented Nov 4, 2023

奇怪,这个如果传了 false 有报错吗 https://github.com/react-component/field-form/blob/master/src/Form.tsx

没懂,这里传了 false 只是隐藏了dom,跟 rc-form 有啥关系吗?

rc-form 看起来也有这个问题

@crazyair
Copy link
Member

crazyair commented Nov 4, 2023

如果 rc-form 没有这个问题,那就是 React.Fragment 这个去掉,就是不用判断 false,应该就能解决这个 issue 的问题

@li-jia-nan
Copy link
Member Author

如果 rc-form 没有这个问题,那就是 React.Fragment 这个去掉,就是不用判断 false,应该就能解决这个 issue 的问题

这里有三个节点,React.Fragment 没办法去掉,就算不判断 false,也得加一个 <></>

@li-jia-nan li-jia-nan merged commit 3f683d7 into master Nov 5, 2023
90 checks passed
@li-jia-nan li-jia-nan deleted the bug-45670 branch November 5, 2023 05:08
@crazyair
Copy link
Member

crazyair commented Nov 5, 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.

Passing component={false} to App show invalid prop warning
3 participants