-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
chore: Improve React Fast Refresh in storybook #7435
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran it locally, I can't get to a bunch of the s1 stories (ie. ActionBar/ActionGroup/Breadcrumbs/Button/ButtonGroup/ColorField/ColorSlider).
ActionBarStory is not defined
works fine in the CI built one, is there some cache I might have locally? i got rid of the parcel cache and cleaned the yarn cache
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally and confirmed that the fast refresh is working properly in both storybooks. Spot checked the rest of the changes to the refs and they seem to be fine
I moved the Parcel plugins we use for storybook into an official Parcel repo: https://github.com/parcel-bundler/storybook. Updated them to handle React Fast Refresh much better than before. Now you can edit a component or a story and it'll hot update without losing state. In addition, updating the prop types in TypeScript will also hot reload without needing to restart Storybook. It also includes the original story source automatically instead of needing to manually copy and paste it into a string.
Fast Refresh also requires us to change the syntax we use for
forwardRef
, since it requires that component names must start with an upper case letter and not an underscore. I wrote a codemod to convert this syntax since it is so pervasive, and it now uses an inline style rather than declaring a separate variable. That is the majority of the diff.