-
Notifications
You must be signed in to change notification settings - Fork 622
Prevent ActionList crash when selected prop is used without selectionVariant #6235
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
Conversation
🦋 Changeset detectedLatest commit: 50662d4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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.
Pull Request Overview
This PR replaces the runtime error thrown when an ActionList item is marked selected
without a selectionVariant
by issuing a development-only warning instead. It also updates the test to expect console.warn
and adds a changeset for the patch release.
- Swapped hard
throw
with a dev-onlywarning
- Adjusted the test to spy on
console.warn
rather than expecting an exception - Added a
.changeset
entry for versioning
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
packages/react/src/ActionList/Selection.tsx | Replace thrown error with a warning util call and return null |
packages/react/src/ActionList/ActionList.test.tsx | Update test to spy on console.warn and verify warning message |
.changeset/true-lines-find.md | Add patch-level changeset for this fix |
) | ||
} else { | ||
return null | ||
warning(true, 'For Item to be selected, ActionList or ActionList.Group should have a selectionVariant defined.') |
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.
The warning
util triggers a warning only when its first argument is falsy. Passing true
here means the warning will never fire. You should pass false
(e.g., warning(false, ...)
) to actually emit the warning in development.
warning(true, 'For Item to be selected, ActionList or ActionList.Group should have a selectionVariant defined.') | |
warning(false, 'For Item to be selected, ActionList or ActionList.Group should have a selectionVariant defined.') |
Copilot uses AI. Check for mistakes.
👋 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! |
size-limit report 📦
|
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! 🎉
Let's run a integration test before we merge.
👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/386657 |
🟢 golden-jobs completed with status |
Closes 5066
Changelog
New
Changed
Removed
Rollout strategy
Testing & Reviewing
Merge checklist