Skip to content

Commit 3a62131

Browse files
rhamiltoclaude
andauthored
fix(ResponsiveAction): resolve warning about accessing reserved 'key' prop (#892)
Fixes #890 The ResponsiveAction component was incorrectly defining 'key' as a prop in its interface, which caused React to warn when developers used the standard key prop pattern with arrays of ResponsiveAction components. Changes: - Removed 'key' from ResponsiveActionProps interface since 'key' is a reserved React prop that cannot be accessed within components - Updated ResponsiveActions to use child.key instead of child.props.key to access React's internal key value without triggering warnings Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 41914e7 commit 3a62131

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

packages/module/src/ResponsiveAction/ResponsiveAction.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ export interface ResponsiveActionProps extends ButtonProps {
77
isPinned?: boolean;
88
/** Determines whether the action should always be displayed as pinned */
99
isPersistent?: boolean;
10-
/** Key for the action */
11-
key?: string;
1210
/** Action label */
1311
children: React.ReactNode;
1412
};

packages/module/src/ResponsiveActions/ResponsiveActions.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export const ResponsiveActions: FunctionComponent<ResponsiveActionsProps> = ({ o
2525

2626
Children.forEach(children, (child, index) => {
2727
if (isValidElement<ResponsiveActionProps>(child)) {
28-
const { isPersistent, isPinned, key = index, children, onClick, ...actionProps } = child.props;
28+
const { isPersistent, isPinned, children, onClick, ...actionProps } = child.props;
29+
const key = child.key ?? index;
2930

3031
if (isPersistent || isPinned) {
3132
(isPersistent ? persistentActions : pinnedActions).push(

0 commit comments

Comments
 (0)