Skip to content

Commit

Permalink
fix(MultiButton): missing key
Browse files Browse the repository at this point in the history
  • Loading branch information
MEsteves22 authored and plagoa committed Apr 17, 2024
1 parent 8861cfa commit 697a404
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/core/src/MultiButton/MultiButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Children,
cloneElement,
Fragment,
isValidElement,
ReactElement,
useMemo,
Expand All @@ -10,6 +11,7 @@ import { HvButtonSize, HvButtonVariant } from "../Button";
import { useDefaultProps } from "../hooks/useDefaultProps";
import { HvBaseProps } from "../types/generic";
import { ExtractNames } from "../utils/classes";
import { setId } from "../utils/setId";
import {
getSplitContainerColor,
getSplitContainerHeight,
Expand Down Expand Up @@ -37,6 +39,7 @@ export interface HvMultiButtonProps extends HvBaseProps {

export const HvMultiButton = (props: HvMultiButtonProps) => {
const {
id,
className,
children,
classes: classesProp,
Expand Down Expand Up @@ -73,6 +76,7 @@ export const HvMultiButton = (props: HvMultiButtonProps) => {

return (
<div
id={id}
className={cx(
classes.root,
{
Expand All @@ -88,8 +92,9 @@ export const HvMultiButton = (props: HvMultiButtonProps) => {
>
{buttons.map((child, index) => {
const childIsSelected = !!child.props.selected;
const btnKey = setId([id, index]);
return (
<>
<Fragment key={btnKey}>
{cloneElement(child, {
variant,
disabled: disabled || child.props.disabled,
Expand All @@ -115,7 +120,7 @@ export const HvMultiButton = (props: HvMultiButtonProps) => {
<div className={classes.split} />
</div>
)}
</>
</Fragment>
);
})}
</div>
Expand Down

0 comments on commit 697a404

Please sign in to comment.