Skip to content

Commit ab504b1

Browse files
authored
fix(declarative-chart): Remove Duplicate keys warning (#33722)
1 parent 1466381 commit ab504b1

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Fix Duplicate keys warning",
4+
"packageName": "@fluentui/react-charting",
5+
"email": "74965306+Anush2303@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/charts/react-charting/src/components/VerticalBarChart/VerticalBarChart.base.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ export class VerticalBarChartBase
786786
const gradientId = getId('VBC_Gradient') + `_${index}_${startColor}`;
787787

788788
return (
789-
<g key={point.x as string}>
789+
<g key={`${point.x}_${index}` as string}>
790790
{this.props.enableGradient && (
791791
<defs>
792792
<linearGradient id={gradientId} x1="0%" y1="100%" x2="0%" y2="0%">
@@ -892,7 +892,7 @@ export class VerticalBarChartBase
892892

893893
return (
894894
<g
895-
key={point.x instanceof Date ? point.x.getTime() : point.x}
895+
key={point.x instanceof Date ? `${point.x.getTime()}_${index}` : `${point.x}_${index}`}
896896
transform={`translate(${0.5 * (xBarScale.bandwidth() - this._barWidth)}, 0)`}
897897
>
898898
{this.props.enableGradient && (
@@ -1005,7 +1005,7 @@ export class VerticalBarChartBase
10051005
const gradientId = getId('VBC_Gradient') + `_${index}_${startColor}`;
10061006

10071007
return (
1008-
<g key={point.x instanceof Date ? point.x.getTime() : point.x}>
1008+
<g key={point.x instanceof Date ? `${point.x.getTime()}_${index}` : `${point.x}_${index}`}>
10091009
{this.props.enableGradient && (
10101010
<defs>
10111011
<linearGradient id={gradientId} x1="0%" y1="100%" x2="0%" y2="0%">

0 commit comments

Comments
 (0)