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

[Bug]: RadioButtonGroup crashes when passed null or undefined as child #16655

Closed
2 tasks done
brandones opened this issue Jun 4, 2024 · 0 comments · Fixed by #16691
Closed
2 tasks done

[Bug]: RadioButtonGroup crashes when passed null or undefined as child #16655

brandones opened this issue Jun 4, 2024 · 0 comments · Fixed by #16691

Comments

@brandones
Copy link
Contributor

Package

@carbon/react

Browser

Chrome

Package version

v11.58.1

React version

v1.58.1

Description

When I pass a null child to a RadioButtonGroup, it crashes. This is because of this line:

        const { value } = (radioButton as ReactElement)?.props ?? undefined;

which attempts to destructure undefined

Reproduction/example

https://stackblitz.com/edit/github-drap92?file=src%2FApp.jsx

Steps to reproduce

    <div>
      hi
      <RadioButtonGroup name="foo">
        <RadioButton labelText="hey" />
        {null}
      </RadioButtonGroup>
    </div>

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

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 a pull request may close this issue.

2 participants