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

DATAP-1533 stacked area chart class to functional #537

Merged
merged 6 commits into from
Sep 10, 2024

Conversation

cdmh219
Copy link
Collaborator

@cdmh219 cdmh219 commented Sep 6, 2024

Conversion of StackedAreaChart from class to functional component

Additions

Removals

Changes

Testing

Screenshots

Notes

Todos

Checklist

  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows the standards laid out in the front end playbook
  • Passes all existing automated tests
  • New functions include new tests
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged
  • Visually tested in supported browsers and devices
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)

@cdmh219 cdmh219 requested a review from flacoman91 September 6, 2024 23:17
@@ -335,17 +335,17 @@ export const pruneIncompleteStackedAreaInterval = (
) => {
const { from: dateFrom, to: dateTo } = dateRange;

const dataClone = cloneDeep(data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what kind of issues were you seeing here, and I think you may not need this

This is doing the exact same thing at L342.

cloneDeep in our utils does the same thing too:
https://github.com/cfpb/ccdb5-ui/blob/main/src/utils/index.js#L209

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cloneDeep(data) value was basically being passed in as a parameter from the component. So instead of doing that, I thought it made more sense to just pass in data, then do the clone here. It cuts down on some of the data processing being done directly in the component, and eliminates a variable that's only used for this.

The same thing was also done for pruneIncompleteLineInterval()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this work without adding this? This looks like it is doing the same thing twice

I would change L342 to
let filteredData = cloneDeep(data);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologoies for the late response (I looked at this yesterday, but forgot to comment here). Changing this results in a state mutation error. And when I tried to use the structuredClone as stated in the comments, it doesn't appear to be available in Lodash. So it looks like we'll need to keep this as-is (at least for now).

@cdmh219 cdmh219 requested a review from flacoman91 September 9, 2024 13:57
@cdmh219 cdmh219 added this pull request to the merge queue Sep 10, 2024
Merged via the queue into main with commit 21ebd31 Sep 10, 2024
2 checks passed
@cdmh219 cdmh219 deleted the DATAP-1533-StackedAreaChart-Class-to-Functional branch September 10, 2024 16:02
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

Successfully merging this pull request may close these issues.

2 participants