-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Storybook 7 #6150
Storybook 7 #6150
Conversation
Sorry I just casually stumbled upon this PR, and also I'm not sure what this comment 👆 really means 😂, but I think Storybook 8 is out now? npm versions, and of course unless there's particular reason to choose v7, maybe upgrading to v8 would be better? |
@sookmax Big emphasis on "attempting" . Upgrading majors for storybook isn't as easy as it sounds unfortunately. There usually ends up being a lot to change, and sometimes blockers. The migration assistants are really helpful, but with a large project and additional configurations, it's still a big task. And to explain that comment, we currently run our tests in React 16, 17, 18, and canary. Running them with canary gives us a heads up on if something will break in a future release, so we can fix it earlier. In the latest canary, they've dropped support for the legacy ReactDOM.render API, so we need to switch everything to work with the newer root API, introduced in React 18. Upgrading storybook to the version that includes that will help. |
@reidbarber Thanks for the detailed explanation. I appreciate it!
I got a little curious about what React render API Storybook uses, and found this migration guide, stating that Storybook 6.5 would use the new |
I noticed that as well. I haven't tried running our storybook with canary, so not sure if any other issues arose when @snowystinger was debugging. |
Hi @sookmax thanks for your interest. The changelog is referencing how storybook renders our components, and unfortunately not how storybook renders its UI/shell. My hope in going to 7 is that 7-8 will be a smaller jump than 6-7. We also have some working repos with parcel + storybook on v7, so we have something to compare against. storybook 8 is a bit more unknown and broke in interesting ways when I tried it. |
@snowystinger Thanks for taking time to explain this to me! Forgive my ignorance, but the reason we care about what React render API the Storybook manager is using is because React as a dependency is being shared between React Aria and Storybook when testing in React 16, 17, 18, and canary? I somehow assumed Storybook would get its React separately and independently from that of React Aria, but I might be wrong. Sorry, It just a little confusing to me 😭.
This sounds reasonable!
Ah right, this definitely makes sense.
Haha, I haven't tried v8 myself yet, but I can see that.. I contributed to Storybook 7 a little bit last year, and well.. their issues and PRs are not very well managed, and they were breaking things too much while moving forward 😅. |
@sookmax correct, it's a peer dependency https://github.com/storybookjs/storybook/blob/next/code/frameworks/react-webpack5/package.json#L55 & https://github.com/storybookjs/storybook/blob/next/code/renderers/react/package.json#L89 |
Yeah you're right. A framework (bundler) and a renderer (react) specifying react and react-dom as peer dependencies make sense since they are responsible for rendering user's react code in the preview (iframe) area. If I remember correctly (I might be wrong), In Storybook 7, the manager (Storybook UI) specifies react as its devDependency and pre-bundle itself using esbuild before distribution. In fact, I think the manager cannot specify react as a peer dependency because the framework and renderer combo might not even include react, yet the manager is always a React app. I checked out But I think it wasn't necessarily the case with SB 6.5 now that I'm looking at Anyways, I appreciate your work on the migration! It must be very challenging though.. haha. P.S. It looks like the manager with react 18 was merged only into Storybook 8 (release-8-0) by storybookjs/storybook#24514 |
some of these tests failures (random timeouts and jest worker being force exited) look pretty similar to the ones I've been getting in the treeview branch, perhaps meaning the babel is indeed to blame? Will try the upgrade on a branch from main |
Build successful! 🎉 |
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.
Thank you for doing this! I like the seperation of chromatic and chromatic-fc. The PR does a good job of hiding the difficulty of getting the correct versions and deduplicating.
@snowystinger Still looking at the code but noticed that the storybook 17 and 16 builds are broken. The other builds (canary + 18) work just fine it seems though, controls/automated test story for Picker/themes/etc seem to be working well Looks like it is trying to call |
looks like problem with the shim, looking into it. Update, I think it has to do with other react versions installed, however, setting a resolution for react did not fix the issue. I do know that it works if I remove the alias for 16 and 17, so I've done that. |
# Conflicts: # package.json # yarn.lock
# Conflicts: # package.json # packages/dev/parcel-packager-ssg/package.json # packages/dev/parcel-resolver-build/package.json # packages/dev/parcel-resolver-docs/package.json # packages/dev/parcel-resolver-optimize-locales/package.json # packages/dev/parcel-resolver-storybook/package.json # packages/dev/parcel-transformer-docs/package.json # packages/dev/parcel-transformer-mdx-docs/package.json # yarn.lock
# Conflicts: # packages/@react-spectrum/card/test/Card.test.js # packages/@react-spectrum/menu/test/SubMenuTrigger.test.tsx
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.
LGTM to me, storybooks seem to work and chromatic runs clean. Just some small changes that I assume were unintentional/from the merge/leftover from testing
"@react-spectrum/layout": "^3.6.3", | ||
"@react-spectrum/utils": "^3.11.5", | ||
"@react-spectrum/view": "^3.6.8", |
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.
Where did these new deps come from? Seems to come up in a couple of the package.json changes, were they auto added by the IDE perhaps? The only imports for these are in the stories and stuff so we don't need them here right?
packages/*/*/i18n | ||
packages/react-aria/dist | ||
packages/react-aria/i18n | ||
packages/react-aria-components/dist | ||
packages/react-aria-components/i18n |
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.
not sure this was intentional or not?
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.
It was, they need to be added to our clean function as well.
I think they came from build, possibly in another branch. Either way, they need to be ignored and/or removed by clean_all
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.
ah I misunderstood, I thought this was ignoring the i18n files like useFilter
, makes sense
# Conflicts: # package.json # packages/@react-spectrum/actionbar/package.json # packages/@react-spectrum/actiongroup/package.json # packages/@react-spectrum/avatar/package.json # packages/@react-spectrum/badge/package.json # packages/@react-spectrum/button/package.json # packages/@react-spectrum/calendar/package.json # packages/@react-spectrum/checkbox/package.json # yarn.lock
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.
Nice!
## API Changes
unknown top level export { type: 'any' } |
Closes
Attempting to upgrade us to storybook 7 so that we can develop against canary since sb7 changed their UI to use the new React render API and React has now removed the old version in canary.
Steps I followed:
run
npx storybook@7.6.17 upgrade
move to new framework
dedupe storybook versions in the lockfile
deduped parcel
deduped babel
patched some files with @devongovett 's help
Storybook now runs!
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: