-
Notifications
You must be signed in to change notification settings - Fork 646
ensure the MappedActionListItem component is a ForwardRef Componenet #7258
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
ensure the MappedActionListItem component is a ForwardRef Componenet #7258
Conversation
🦋 Changeset detectedLatest commit: 142f013 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 |
|
👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the |
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 converts the MappedActionListItem component to use React's forwardRef, enabling ref forwarding to the underlying ActionList.Item component. This change supports virtualization with dynamic height measurement in the SelectPanel component, allowing proper calculation of item heights when text wraps.
Key Changes:
- Converted
MappedActionListItemfrom a regular function to a forwardRef component with proper TypeScript typing (forwardRef<HTMLLIElement, ItemInput & {renderItem?: RenderItemFn}>) - Updated the Virtualized story in SelectPanel to demonstrate dynamic height measurement using refs and the TanStack Virtual library
- Added a test item with long text to showcase text wrapping behavior
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/react/src/FilteredActionList/FilteredActionList.tsx | Converted MappedActionListItem to a forwardRef component and added ref prop forwarding to ActionList.Item |
| packages/react/src/SelectPanel/SelectPanel.examples.stories.tsx | Enhanced virtualization example with dynamic height measurement using measureElement, added test item with wrapping text, and removed debug flag |
| .changeset/dry-pets-appear.md | Added changeset documenting the minor version change |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| </ActionList.Item> | ||
| ) | ||
| } | ||
| }) |
Copilot
AI
Dec 2, 2025
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.
[nitpick] Consider adding a displayName to the MappedActionListItem component for better debugging experience in React DevTools. While it's an internal component, setting displayName is a best practice for forwardRef components in this codebase.
Example:
const MappedActionListItem = forwardRef<HTMLLIElement, ItemInput & {renderItem?: RenderItemFn}>((item, ref) => {
// ... component implementation
})
MappedActionListItem.displayName = 'MappedActionListItem'| }) | |
| }) | |
| MappedActionListItem.displayName = 'MappedActionListItem' |
I need to be able to calculate the height of a virtualized item if text overflows. In order to do this I will need to set up a Ref on
ActionList.itemChangelog
Ensure MappedActionListItem is a forwardRef component
New
Changed
Removed
Rollout strategy
Testing & Reviewing
Merge checklist