Skip to content

fix(tilegroup): guard usage of potentially null children properties #17258

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

Merged

Conversation

tay1orjones
Copy link
Member

@tay1orjones tay1orjones commented Aug 23, 2024

Surfaced in slack

When conditionally rendering RadioTiles within a TileGroup a race condition existed where children properties (child.type, child.props.children) could be null and would throw an uncaught exception.

Original repro: https://stackblitz.com/edit/github-mgvclx?file=src%2FExample%2FExample.jsx

Changelog

New

  • Add a test to cover this race condition

Changed

  • Use optional chaining on child property assertions

Testing / Reviewing

  • You can recreate the repro locally to validate it'll work, but the new test covers it as well and should pass.

Copy link
Contributor

@guidari guidari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!! 🚀

Copy link

netlify bot commented Aug 23, 2024

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit ab1a763
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/66c8a8725e25460008a22767
😎 Deploy Preview https://deploy-preview-17258--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Aug 23, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit ab1a763
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/66c8a872e16b190008ad9e03
😎 Deploy Preview https://deploy-preview-17258--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tay1orjones tay1orjones added this pull request to the merge queue Aug 23, 2024
Merged via the queue into carbon-design-system:main with commit 7433ebf Aug 23, 2024
22 checks passed
@tay1orjones tay1orjones deleted the fix-tilegroup-children branch August 23, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants