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

fix: #3073 #3862

Merged
merged 2 commits into from Oct 17, 2023
Merged

fix: #3073 #3862

merged 2 commits into from Oct 17, 2023

Conversation

HHongSeungWoo
Copy link
Member

@HHongSeungWoo HHongSeungWoo commented Oct 15, 2023

I have fixed the bug.

before

bug.mp4

after

fix.mp4

Related Issue

#3073

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • 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:

  • 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
  • All new and existing tests passed.

@HHongSeungWoo HHongSeungWoo changed the title fix: #3859 fix: #3073 Oct 15, 2023
@ckifer
Copy link
Member

ckifer commented Oct 15, 2023

@HHongSeungWoo do you know why this worked on some browsers and not others?

@HHongSeungWoo
Copy link
Member Author

HHongSeungWoo commented Oct 15, 2023

@ckifer If you are referring to Firefox DevTools, Firefox's mobile mode does not simulate mobile devices like Chrome does. It shows mobile pages but triggers mouse events.

@ckifer
Copy link
Member

ckifer commented Oct 15, 2023

Oh wow that's good to know 🙃.

Cool, will review this more later

Copy link
Contributor

@nikolasrieble nikolasrieble left a comment

Choose a reason for hiding this comment

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

Looks like a cleanup mostly, I have a few questions. Thank you for your contribution.

@@ -1116,8 +1114,7 @@ export const generateCategoricalChart = ({
constructor(props: CategoricalChartProps) {
super(props);

this.uniqueChartId = _.isNil(props.id) ? uniqueId('recharts') : props.id;
this.clipPathId = `${this.uniqueChartId}-clip`;
this.clipPathId = `${props.id ?? uniqueId('recharts')}-clip`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. Love the small cleanups.

src/chart/generateCategoricalChart.tsx Show resolved Hide resolved
Comment on lines 1664 to 1666
if (!_.isNil(syncId)) {
eventCenter.emit(SYNC_EVENT, syncId, this.uniqueChartId, data);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, why can we remove this? Can the syncId no longer be null?

Copy link
Contributor

Choose a reason for hiding this comment

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

How are we making sure it is not null? Could a user not still set it to null?

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Member Author

Choose a reason for hiding this comment

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

It was just a missed. Thank you for finding

@@ -751,7 +750,7 @@ describe('<LineChart /> - Rendering two line charts with syncId', () => {
expect(container.querySelectorAll('.recharts-tooltip-cursor')).toHaveLength(2);

// make sure tooltips display the correct values, synced by data value
expect(screen.queryByText('400')).toBeTruthy();
expect(screen.queryByText('300')).toBeTruthy();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is surprising. Did the test previously capture behaviour that was a bug itself?
Could you please add a storybook test (i.e. in a play function for a story with syncId) to verify that the syncId still works correctly?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great, I'll give it a try.


if (!_.isNil(syncId)) {
eventCenter.emit(SYNC_EVENT, syncId, this.uniqueChartId, data);
if (this.props.syncId !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (this.props.syncId !== undefined) {
if (this.props.syncId != undefined) {

I assume we would also want to catch null, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, there shouldn't be null. Typing errors should be caught by TypeScript.

Copy link
Member

@ckifer ckifer left a comment

Choose a reason for hiding this comment

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

I'm satisfied with this, I think since we've just done a release there is plenty of time to see if this causes any regressions. Not too worried about that though

@ckifer ckifer merged commit 6f9f374 into recharts:master Oct 17, 2023
5 checks passed
@HHongSeungWoo HHongSeungWoo deleted the fix/3859 branch October 17, 2023 16:55
GMer78 pushed a commit to GMer78/recharts-1 that referenced this pull request Nov 24, 2023
<!--- Provide a general summary of your changes in the Title above -->

I have fixed the bug.

before


https://github.com/recharts/recharts/assets/34399997/6cae6da9-d761-4864-a3a5-442b0e6d3fa5


after


https://github.com/recharts/recharts/assets/34399997/6156aa9c-eeaf-4b95-bbe0-bd77c8c5dbde


<!--- Describe your changes in detail -->

## Related Issue

recharts#3073

<!--- 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? -->

## 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. -->

## 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.
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.

None yet

3 participants