Skip to content

fix: update CheckboxOrRadioGroup to spread empty object instead of false-y value #5764

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
merged 3 commits into from
Mar 14, 2025

Conversation

joshblack
Copy link
Member

@joshblack joshblack commented Mar 11, 2025

Address an issue that comes up in React 19 that looks like:

Uncaught TypeError: Cannot use 'in' operator to search for '__self' in false
    at exports.createElement (react.development.js:1294:13)
    at CheckboxOrRadioGroup (CheckboxOrRadioGroup.js:174:38)
    at react-stack-bottom-frame (react-dom-client.development.js:22428:20)
    at renderWithHooks (react-dom-client.development.js:5757:22)
    at updateFunctionComponent (react-dom-client.development.js:8018:19)
    at beginWork (react-dom-client.development.js:9683:18)
    at runWithFiberInDEV (react-dom-client.development.js:543:16)
    at performUnitOfWork (react-dom-client.development.js:15044:22)
    at workLoopSync (react-dom-client.development.js:14870:41)
    at renderRootSync (react-dom-client.development.js:14850:11)
exports.createElement @ react.development.js:1294
CheckboxOrRadioGroup @ CheckboxOrRadioGroup.js:174
react-stack-bottom-frame @ react-dom-client.development.js:22428
renderWithHooks @ react-dom-client.development.js:5757

This seems to come from this transpiled code:

/*#__PURE__*/React.createElement(Body, !labelChild && {
    ['aria-labelledby']: ariaLabelledby,
    ['aria-describedby']: [validationMessageId, captionId].filter(Boolean).join(' '),
    as: 'div',
    role: 'group'
  }

Specifically where we are short circuiting the second argument to createElement to be false which is what is triggering the error above. This updates the checks in these files to pass along an empty object instead.

Changelog

New

Changed

  • Update labelChild values to pass in empty object in the alternative case

Removed

Rollout strategy

  • Patch release

@joshblack joshblack requested a review from a team as a code owner March 11, 2025 20:48
@joshblack joshblack requested a review from francinelucca March 11, 2025 20:48
@github-actions github-actions bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Mar 11, 2025
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

Copy link
Contributor

github-actions bot commented Mar 11, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 105.96 KB (-0.08% 🔽)
packages/react/dist/browser.umd.js 106.41 KB (+0.07% 🔺)

Copy link

changeset-bot bot commented Mar 11, 2025

🦋 Changeset detected

Latest commit: 7a0475c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot temporarily deployed to storybook-preview-5764 March 13, 2025 15:36 Inactive
@joshblack joshblack added this pull request to the merge queue Mar 14, 2025
Merged via the queue into main with commit c63e805 Mar 14, 2025
44 checks passed
@joshblack joshblack deleted the joshblack-patch-3 branch March 14, 2025 15:20
@primer primer bot mentioned this pull request Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants