Skip to content

React: Add react fast refresh #12470

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

Merged
merged 17 commits into from
Sep 20, 2020
Merged

React: Add react fast refresh #12470

merged 17 commits into from
Sep 20, 2020

Conversation

tooppaaa
Copy link
Contributor

@tooppaaa tooppaaa commented Sep 14, 2020

Issue: #10602

What I did

Add @pmmmwh/react-refresh-webpack-plugin and react-refresh as part of the react preset, enabling out of the box support for fast refresh.

@shilman shilman changed the title React: add react refresh React: Add react refresh Sep 14, 2020
@tooppaaa tooppaaa added react maintenance User-facing maintenance tasks labels Sep 14, 2020
@tooppaaa tooppaaa marked this pull request as ready for review September 14, 2020 10:53
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

@tooppaaa is this backwards compatible?

@tooppaaa
Copy link
Contributor Author

@shilman It is now an OPT IN feature.
I added frameworkOptions and typings for react as well, missing a unit test but I'm not able to run them on my machine.

@yannbf can we pair on this last bit ?

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Tremendous work @tooppaaa @yannbf 💯

I'm guessing you're on top of those CI errors?

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Does the documentation need updating?

@yannbf
Copy link
Member

yannbf commented Sep 15, 2020

Does the documentation need updating?

It was added here

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Great work guys 👏 👏 👏

@shilman shilman changed the title React: Add react refresh React: Add react fast-refresh Sep 15, 2020
@shilman shilman changed the title React: Add react fast-refresh React: Add react-refresh Sep 15, 2020
@@ -0,0 +1,10 @@
import { StorybookOptions as BaseOptions } from '@storybook/core/types';
Copy link
Member

Choose a reason for hiding this comment

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

should this be import type? does it matter?

Copy link
Member

Choose a reason for hiding this comment

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

I think it doesn't matter much in this case. It's just a new syntax for the same thing. It's nice when there are mixed imports (types and non-types) because it makes the code more understandable, but in that case I personally feel it doesn't make a difference

@@ -1,4 +1,4 @@
import type { StorybookConfig } from '@storybook/core/types';
import type { StorybookConfig } from '@storybook/react/types';
Copy link
Member

Choose a reason for hiding this comment

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

@hipstersmoothie is getting rid of all these separate entry points in #12462 ... i don't fully understand the rationale, but i'm wondering whether we should follow that pattern here

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure, but wouldn't it be better if we would merge this and take care of the detail either in his PR or after that's been merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CRA does not yet support import type which forces me to extract config typings in a dedicated place.
Using existing typings causes "import type" being use by storybook and react-docgen-typescript with the crashes we saw on CI (reproduced locally)

@shilman shilman added feature request and removed maintenance User-facing maintenance tasks labels Sep 20, 2020
@shilman shilman added this to the 6.1 maintenance milestone Sep 20, 2020
@shilman shilman merged commit ea341b5 into next Sep 20, 2020
@shilman shilman deleted the react/refresh2 branch September 20, 2020 16:07
@tmeasday
Copy link
Member

👏 👏 👏 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants