Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

chore: Fix react key spread warning (#3463)

Oleg Isonen5df7b1aa68f6
diff --git a/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx b/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx
index c8678cea3a..58ef920c92 100644
--- a/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx
+++ b/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx
@@ -522,11 +522,13 @@ export const StyleSourceInput = (
if (item.id === newItemId) {
hasNewTokenItem = true;
+ const { key, ...itemProps } = getItemProps({ item, index });
return (
<Fragment key={index}>
<ComboboxLabel>New Token</ComboboxLabel>
<ComboboxListboxItem
- {...getItemProps({ item, index })}
+ {...itemProps}
+ key={key}
selectable={false}
>
<div>
@@ -565,11 +567,13 @@ export const StyleSourceInput = (
</>
);
}
+ const { key, ...itemProps } = getItemProps({ item, index });
return (
<Fragment key={index}>
{label}
<ComboboxListboxItem
- {...getItemProps({ item, index })}
+ {...itemProps}
+ key={key}
selectable={false}
>
<StyleSourceBadge source={item.source}>
diff --git a/packages/design-system/src/components/combobox.tsx b/packages/design-system/src/components/combobox.tsx
index b043a4f515..5e39e1159b 100644
--- a/packages/design-system/src/components/combobox.tsx
+++ b/packages/design-system/src/components/combobox.tsx
@@ -103,12 +103,12 @@ const ListboxItemBase: ForwardRefRenderFunction<
return (
<ListboxItem
- ref={ref}
{...(disabled ? { "aria-disabled": true, disabled: true } : {})}
{...(selected ? { "aria-current": true } : {})}
{...(disabled ? {} : rest)}
withIndicator={selectable}
text={rest.text ?? "sentence"}
+ ref={ref}
>
{selectable && selected && <Indicator>{icon}</Indicator>}
{children}