Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Legend/> should warn users to pass a name to a chart's cartesian components when a function is used as a dataKey. #3757

Closed
1 task done
chris-mcdonald-dev opened this issue Sep 15, 2023 · 2 comments

Comments

@chris-mcdonald-dev
Copy link
Contributor

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

See #3749

What is expected?

Need to prevent callback function from being called without the payload as a parameter. Instead, it should prompt API users to use the name property on the cartesian component being used and render and empty string instead.

What is actually happening?

See #3749

Environment Info
Recharts v2.8.0
React 18.2
System Ubuntu 22.04
Browser Edge 116
@chris-mcdonald-dev
Copy link
Contributor Author

Have PR fix ready. Pushing soon.

ckifer pushed a commit that referenced this issue Sep 15, 2023
<!--- Provide a general summary of your changes in the Title above -->
## Description
Always renders static string in `<Legend/>` when functions are passed as
a dataKey to sibling cartesian components. Prompts the API user to
include the `name` property when `entry.value` is a function.
<!--- Describe your changes in detail -->

## Related Issue
#3757
<!--- 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: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
Addresses problems brought up in #3750.
## How Has This Been Tested?
Includes unit tests checking that name prop is rendered when functions
are passed and when the name prop is missing.
<!--- 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. -->

## 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.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
@ckifer
Copy link
Member

ckifer commented Sep 15, 2023

Addressed with warning! Closing this up

@ckifer ckifer closed this as completed Sep 15, 2023
GMer78 pushed a commit to GMer78/recharts-1 that referenced this issue Nov 24, 2023
<!--- Provide a general summary of your changes in the Title above -->
## Description
Always renders static string in `<Legend/>` when functions are passed as
a dataKey to sibling cartesian components. Prompts the API user to
include the `name` property when `entry.value` is a function.
<!--- Describe your changes in detail -->

## Related Issue
recharts#3757
<!--- 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: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
Addresses problems brought up in recharts#3750.
## How Has This Been Tested?
Includes unit tests checking that name prop is rendered when functions
are passed and when the name prop is missing.
<!--- 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. -->

## 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.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants