diff --git a/src/ActionList/Item.tsx b/src/ActionList/Item.tsx index 4a7b2c20e1c..d3d8797f3c9 100644 --- a/src/ActionList/Item.tsx +++ b/src/ActionList/Item.tsx @@ -1,5 +1,5 @@ import {CheckIcon, IconProps} from '@primer/octicons-react' -import React, {useCallback} from 'react' +import React, {useCallback, useMemo} from 'react' import {get} from '../constants' import sx, {SxProp} from '../sx' import Truncate from '../Truncate' @@ -307,10 +307,12 @@ export function Item(itemProps: Partial & {item?: ItemInput}): JSX.El onKeyPress, children, onClick, - id = uniqueId(), + id: _id, ...props } = itemProps + const id = useMemo(() => _id ?? uniqueId(), [_id]) + const keyPressHandler = useCallback( event => { if (disabled) {