Skip to content

Commit

Permalink
fix: pie label keys are not unique (#4224)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->
continue to undo key changes... πŸ™ƒ 

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->
#4219

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
errors thrown when data is duplicated or when 0 is used as a datapoint

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
use 0 as a datapoint and dont log a unique key error

## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [X] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] I have added a storybook story or extended an existing story to
show my changes
- [X] All new and existing tests passed.

Co-authored-by: Coltin Kifer <ckifer@amazon.com>
  • Loading branch information
ckifer and Coltin Kifer committed Feb 23, 2024
1 parent e2927b6 commit 1e7ff20
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/polar/Pie.tsx
Expand Up @@ -467,7 +467,8 @@ export class Pie extends PureComponent<Props, State> {
}

return (
<Layer key={`label-${entry.startAngle}-${entry.endAngle}`}>
// eslint-disable-next-line react/no-array-index-key
<Layer key={`label-${entry.startAngle}-${entry.endAngle}-${entry.midAngle}-${i}`}>
{labelLine && Pie.renderLabelLineItem(labelLine, lineProps)}
{Pie.renderLabelItem(label, labelProps, getValueByDataKey(entry, realDataKey))}
</Layer>
Expand Down

0 comments on commit 1e7ff20

Please sign in to comment.