Skip to content

Commit

Permalink
fix: updated TwoColumnPanel to not override children keys (#1100)
Browse files Browse the repository at this point in the history
Closes #924
  • Loading branch information
Bracciata authored Jun 28, 2023
1 parent fe1c8ad commit b60588f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/react/src/components/TwoColumnPanel/TwoColumnPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ const TwoColumnPanel = forwardRef<HTMLDivElement, TwoColumnPanelProps>(
columnLeft,
{ id, ref, tabIndex: -1 },
children.map((child, index) =>
cloneElement(child as React.ReactElement, { key: `left-${index}` })
cloneElement(child as React.ReactElement, {
key: (child as React.ReactElement).key
? (child as React.ReactElement).key
: `left-${index}`
})
)
);
}
Expand Down Expand Up @@ -151,7 +155,11 @@ const TwoColumnPanel = forwardRef<HTMLDivElement, TwoColumnPanelProps>(
columnRight,
{ ref, tabIndex: -1 },
children.map((child, index) =>
cloneElement(child as React.ReactElement, { key: `right-${index}` })
cloneElement(child as React.ReactElement, {
key: (child as React.ReactElement).key
? (child as React.ReactElement).key
: `right-${index}`
})
)
);
}
Expand Down

0 comments on commit b60588f

Please sign in to comment.