Refactored: added default values in params for ReferenceArea and ReferenceLine since default props is deprecated#3283
Merged
ckifer merged 2 commits intoJan 26, 2023
Conversation
…ecated - updated ReferenceArea - updated ReferenceLine
ckifer
approved these changes
Jan 26, 2023
|
|
||
| export function ReferenceArea(props: Props) { | ||
| export function ReferenceArea({ | ||
| isFront = false, |
Member
There was a problem hiding this comment.
destructuring props here doesn't really do anything for us if they're just added back into the props object below. I guess a future refactor can be to use the destructured values directly where possible.
Contributor
Author
There was a problem hiding this comment.
Will work on this and the build failing issue
Contributor
Author
There was a problem hiding this comment.
@ckifer
only when am destructuring the xAxis and yAxis are becoming undefined . Any reason why this is happening

Member
There was a problem hiding this comment.
probably because 0 is falsy, but not sure
… in generateCatergoricalChart component
Closed
1 task
Closed
1 task
Member
ckifer
pushed a commit
to ckifer/recharts
that referenced
this pull request
Mar 14, 2023
…and ReferenceLine since default props is deprecated (recharts#3283)" This reverts commit ea13805.
8 tasks
ckifer
pushed a commit
to ckifer/recharts
that referenced
this pull request
Mar 14, 2023
…and ReferenceLine since default props is deprecated (recharts#3283)" This reverts commit ea13805.
ckifer
added a commit
that referenced
this pull request
Mar 14, 2023
…nd ReferenceLine since default props is deprecated (#3455) …(#3283)" This reverts commit ea13805. <!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> See comment here #3438 (comment) Basically recharts breaks down without defaultProps because it references props set by defaultProps _outside_ of said component (antipattern alert 🚫) before the components are initialized/invoked. Default parameters do not get set until the component is run - before that function components only have reference to the props sent by the user. This will be a huge undertaking to fix. For now revert the change. Two other small changes with this revert: * fixed annoying eslint issue * added storybook test ## 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: --> #3438 ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> bug introduced in 2.4.x ## 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. --> * existing tests pass * run on storybook * settings are now set correctly * add storybook test ## 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. - [x] All new and existing tests passed. Co-authored-by: Coltin Kifer <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Have destructed the props in the params added the value and combined them into a prop object so that it can be passed down to other functions with the default value.
Related Issue
#3278
Motivation and Context
Since defaultProps is deprecated, we would avoid future potential warnings/errors
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: