-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(Tabs): Allow rendering Tabs and TabPanels conditionally again #17859
fix(Tabs): Allow rendering Tabs and TabPanels conditionally again #17859
Conversation
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17859 +/- ##
=======================================
Coverage 80.14% 80.15%
=======================================
Files 406 406
Lines 14030 14031 +1
Branches 4343 4345 +2
=======================================
+ Hits 11245 11246 +1
Misses 2619 2619
Partials 166 166 ☔ View full report in Codecov by Sentry. |
This change allows users again to conditionally render children of TabPanels: If children are not filtered for nullish/falsy values before cloning them, `React.cloneElement` will fail. This regression has been introduced with commit: f406632, Tabs.tsx:L1257
b7669fb
to
d3c961e
Compare
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.
LGTM!
a24e338
This change allows users to conditionally render children of TabPanels again: If children are not filtered for nullish/falsy values before cloning them,
React.cloneElement
will fail with:Error: React.cloneElement(...): The argument must be a React element, but you passed null.
.This regression has been introduced with commit: f4066328a01bd9431f16ccc0c8b646f1f6d8a26e, Tabs.tsx:L1257
Changelog
Changed
TabPanels
for nullish or falsy values usingisElement
before cloning them.Testing / Reviewing