From 5107ea6f058689d0a25272bd4b02fc1edadf5fa2 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Mon, 8 Dec 2025 13:59:29 +0000 Subject: [PATCH] Fixed React development mode warnings in admin-x-design-system no issue Some aspects of `admin-x-design-system` and its usage within `admin-x-settings` caused a lot of errors to be output in the console in development mode making it difficult to find real problems. - Added missing `key` props to list items in `TabView`, `ButtonGroup`, `CheckboxGroup`, and `TiersList` to fix "unique key" warnings - Added `asChild` to `Tooltip`'s `TooltipPrimitive.Trigger` to fix nested button warning when Button components are wrapped in Tooltip - Destructured unused `separator` prop in NewsletterItemContainer to prevent it being passed to `DragIndicator` causing errors --- .../admin-x-design-system/src/global/button-group.tsx | 11 ++++++----- .../src/global/form/checkbox-group.tsx | 4 ++-- apps/admin-x-design-system/src/global/tab-view.tsx | 4 ++-- apps/admin-x-design-system/src/global/tooltip.tsx | 2 +- .../settings/email/newsletters/newsletters-list.tsx | 3 +++ .../settings/membership/tiers/tiers-list.tsx | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/apps/admin-x-design-system/src/global/button-group.tsx b/apps/admin-x-design-system/src/global/button-group.tsx index 098e137a9cd..3ca58cc6413 100644 --- a/apps/admin-x-design-system/src/global/button-group.tsx +++ b/apps/admin-x-design-system/src/global/button-group.tsx @@ -39,13 +39,14 @@ const ButtonGroup: React.FC = ({size = 'md', buttons, link, li return (
- {buttons.map(({key, ...props}) => { + {buttons.map(({key, ...props}, index) => { + const buttonKey = key ?? `button-${index}`; const buttonProps = {...props}; if (!link && !clearBg) { buttonProps.className = clsx(props.className, 'w-8 rounded-lg border !px-0'); - if (key === activeKey) { + if (buttonKey === activeKey) { buttonProps.color = 'white'; buttonProps.className = clsx(buttonProps.className, 'border-grey-300 shadow-xs dark:border-grey-800'); } else { @@ -55,10 +56,10 @@ const ButtonGroup: React.FC = ({size = 'md', buttons, link, li return ( (props.tooltip ? - -