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

Reference react-vis properly from showcase. #1326

Merged
merged 7 commits into from
May 24, 2020

Conversation

Xiot
Copy link
Contributor

@Xiot Xiot commented May 24, 2020

Showcase was using 'index' when importing 'react-vis';
This causes issues when trying to migrate to babel 7.

Showcase was using 'index' when importing 'react-vis';
This causes issues when trying to migrate to babel 7.
@Xiot Xiot mentioned this pull request May 24, 2020
Copy link
Contributor

@chrisirhc chrisirhc left a comment

Choose a reason for hiding this comment

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

The alias change in package.json is fishy. Shouldn't the fix be on showcase's resolver config?

],
"alias": {
"react-vis/*": "src/*"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems incorrect? shouldn't this be in showcase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Theres a whole bunch of indirection happening with the references between these projects. I'm trying to narrow it down.

Of course, these tests all work on my machine :P

@@ -162,9 +161,8 @@ test('testing flexible charts', t => {
test('Render two stacked bar series with a non-stacked line series chart', t => {
const $ = mount(<MixedStackedChart />);

const renderedBarsWrapper = $.find(BarSeries);
const renderedLineWrapper = $.find(LineSeries);
Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty sure this was correct before. Why do we need to change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The BarSeries that the showcase is referencing, is different than the BarSeries in the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed the imports and I was able to change this back so that its properly referencing the same instance of the components.

@@ -19,7 +19,7 @@
// THE SOFTWARE.

import React from 'react';
import {AreaSeries, HorizontalBarSeries, XAxis, XYPlot, YAxis} from 'index';
import {AreaSeries, HorizontalBarSeries, XAxis, XYPlot, YAxis}from 'react-vis';
Copy link
Contributor

Choose a reason for hiding this comment

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

prettier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for some reason prettier doesn't seem to be working. I can look into this later.

@Xiot Xiot marked this pull request as draft May 24, 2020 18:38
@Xiot Xiot mentioned this pull request May 24, 2020
3 tasks
@Xiot Xiot marked this pull request as ready for review May 24, 2020 19:19
@@ -20,7 +20,7 @@

import React from 'react';

import DiscreteColorLegend from 'legends/discrete-color-legend';
import DiscreteColorLegend from 'react-vis/legends/discrete-color-legend';
Copy link
Contributor

Choose a reason for hiding this comment

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

We might want to check whether react-vis exports components in this way, since these showcase files can be used to demonstrate code and be easily-copy-pastable. But that can be a future task. This change seems to be in the right direction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the way that react-vis exports items.
Although, we should eventually change these imports only use the root react-vis.
This allows us to easily curate our public api.

In general, you shouldn't really import more than one level into a library as it tends to be internal. baseui just recently added lint warnings if you try to go more than 2 levels deep in your imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually... I need to test this..

"."
],
"alias": {
"react-vis/*": "../react-vis/src/*",
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting that we need this statement. Makes sense.
Do we need to remove some duplication from the storybook webpack config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need this so that the tests will pick up the same instances of the components as the tests.
Eventually we will need the tests to use their own plots.
The way things are now, a simple change to the showcase can break the tests, which definitely isn't ideal.

@Xiot Xiot merged commit 92de1e2 into uber:yarn-workspaces May 24, 2020
@Xiot Xiot deleted the fix-imports branch May 24, 2020 20:47
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