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

chore: Improve React Fast Refresh in storybook #7435

Merged
merged 5 commits into from
Nov 26, 2024
Merged

Conversation

devongovett
Copy link
Member

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.

@devongovett devongovett changed the title Improve React Fast Refresh in storybook chore: Improve React Fast Refresh in storybook Nov 26, 2024
@rspbot
Copy link

rspbot commented Nov 26, 2024

snowystinger
snowystinger previously approved these changes Nov 26, 2024
Copy link
Member

@snowystinger snowystinger left a 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

@rspbot
Copy link

rspbot commented Nov 26, 2024

Copy link
Member

@LFDanLu LFDanLu left a 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

@devongovett devongovett added this pull request to the merge queue Nov 26, 2024
Merged via the queue into main with commit 10a43de Nov 26, 2024
30 checks passed
@devongovett devongovett deleted the fast-refresh branch November 26, 2024 19:45
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.

4 participants