recharts: Pie chart with animation causes 'non-unique keys' react-dom warning

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Open codesandbox and open console, see react non-unique key warnings.

What is expected?

All generated sector elements have a unique key in any case.

What is actually happening?

If isAnimationActive is set to true all sectors in the pie chart are initially rendered with the same start and end angle and therefore have the same key prop.

Environment Info
Recharts v2.10.2
React react 18.2.0
System MacOS 14.1.1
Browser Chrome 119.0.6045.159

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 1
  • Comments: 26 (18 by maintainers)

Commits related to this issue

Most upvoted comments

@ckifer I’ve done a little more testing. It seems to show warning when two or more items of data have value property equals zero.

CodeSandbox to check out.

I have also been facing this warning with PieChart.

recharts: 2.10.4 react: 18.2.0

Surely 👍

  • Can this convo be “migrated” to this issue? there are perhaps many keys that need updating that aren’t “throwing” lint errors during development 😕 I can post more based on some of my findings either here or the other issue