-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Update dependencies for React 19 type compatibility #30031
base: next
Are you sure you want to change the base?
Conversation
This fixes its usage of the global JSX namespace
It would be EPIC if this could be pack-ported to Storybook v6 and v7 🚀 |
OK, I found the problem with building |
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
5 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
Thanks for your contribution @mrginglymus! I have started a canary release so you can test it out in a real scenario. @imjordanxd unfortunately won't happen, it would be amazing if you could upgrade your project instead. There are a ton of incredible fixes and features we have shipped since Storybook 6/7, please consider upgrading if possible. |
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
5 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
View your CI Pipeline Execution ↗ for commit ea33075.
☁️ Nx Cloud last updated this comment at |
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
Before | After | Difference | |
---|---|---|---|
Dependency count | 50 | 50 | 0 |
Self size | 21.45 MB | 21.40 MB | 🎉 -43 KB 🎉 |
Dependency size | 14.37 MB | 14.37 MB | 0 B |
Bundle Size Analyzer | Link | Link |
storybook
Before | After | Difference | |
---|---|---|---|
Dependency count | 51 | 51 | 0 |
Self size | 22 KB | 22 KB | 0 B |
Dependency size | 35.81 MB | 35.77 MB | 🎉 -43 KB 🎉 |
Bundle Size Analyzer | Link | Link |
sb
Before | After | Difference | |
---|---|---|---|
Dependency count | 52 | 52 | 0 |
Self size | 1 KB | 1 KB | 0 B |
Dependency size | 35.84 MB | 35.79 MB | 🎉 -43 KB 🎉 |
Bundle Size Analyzer | Link | Link |
@storybook/cli
Before | After | Difference | |
---|---|---|---|
Dependency count | 393 | 393 | 0 |
Self size | 496 KB | 496 KB | 0 B |
Dependency size | 77.68 MB | 77.63 MB | 🎉 -43 KB 🎉 |
Bundle Size Analyzer | Link | Link |
@storybook/codemod
Before | After | Difference | |
---|---|---|---|
Dependency count | 273 | 273 | 0 |
Self size | 612 KB | 612 KB | 0 B |
Dependency size | 67.58 MB | 67.53 MB | 🎉 -43 KB 🎉 |
Bundle Size Analyzer | Link | Link |
create-storybook
Before | After | Difference | |
---|---|---|---|
Dependency count | 109 | 109 | 0 |
Self size | 1.11 MB | 1.11 MB | 0 B |
Dependency size | 44.95 MB | 44.90 MB | 🎉 -43 KB 🎉 |
Bundle Size Analyzer | Link | Link |
Thanks - my project now passes type checking and the storybook continues to build correctly using this canary release |
Hey @mrginglymus thanks for getting back to us! We as a team feel like the markdown-to-jsx dep shouldn't be patched. Ideally the maintainers of markdown-to-jsx should make a release with the fix. Seems like the repo is quite active, I'm wondering if you got around to either reporting or making a PR to their repo? |
This is all nonsense (: |
Actually, the change seems pretty trivial so hopefully it'll be ok. |
5acb6e1
to
bc8d69e
Compare
@yannbf PR updated with the now fixed-at-source markdown-to-jsx |
FYI Closes #30104 |
@mrginglymus seems like some types are failing, can you check?
@kasperpeulen can you assist if needed? |
Ah sorry, only just spotted those. There's some lovely weirdness where the checks are passing on Windows (except for svelte - https://cloud.nx.app/runs/nCgcPQNBdY). Also, running with the
on both windows and linux. I'm stuck between not being able to build from an empty cache on windows, and the ts language service not seeming to work in WSL, so I can't offer much of a better fix than just throwing a few Windows support might be aided by fixing these lines: storybook/code/core/scripts/helpers/generateTypesMapperFiles.ts Lines 16 to 17 in 3b18e74
to add a .replaceAll(path.sep, '/') , but I'm curious as to whether storybook have considered using typescript project references to simplify the build system and avoid the need for temporary stubs
edit: #30148 raised to enhance windows support |
Hmm, it looks like all of these are caused by emotion-js/emotion#3164 . The offending code looks like this: const MyComponent = styled.xxx(() => ({
...
})); ie, a styled component with no theme arg I can see three options for fixing:
const MyComponent = styled.xxx(() => ({
...
} as const));
const MyComponent = styled.xxx({
...
});
|
Closes #30104
What I did
A number of bundled packages in storybook still use the deprecated global
JSX
namespace from React; this PR makes minor updates to those packages to bring in React 19 type-compatible versions.There may be further issues with
@storybook/blocks
, but I'm having trouble building it (even onnext
). I'm on a limited dev environment as I only have access to a Windows and WSL dev environment, and storybook does not play nice with Windows...Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This pull request has been released as version
0.0.0-pr-30031-sha-5acb6e15
. Try it out in a new sandbox by runningnpx storybook@0.0.0-pr-30031-sha-5acb6e15 sandbox
or in an existing project withnpx storybook@0.0.0-pr-30031-sha-5acb6e15 upgrade
.More information
0.0.0-pr-30031-sha-5acb6e15
r19-type-compat
5acb6e15
1734168729
)To request a new release of this pull request, mention the
@storybookjs/core
team.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=30031
Greptile Summary
Updates dependencies and type definitions across multiple packages to ensure compatibility with React 19, particularly addressing the deprecated global JSX namespace.
code/.yarn/patches/markdown-to-jsx-npm-7.7.1-6038885620.patch
to useReact.ReactNode
instead ofReact.ReactChild
code/lib/blocks/package.json
to include React 19 betacode/renderers/react/src/types.ts
to import JSX namespace directly from Reactcode/core/package.json
for React 19 compatibilitycode/lib/blocks/src/blocks/mdx.tsx
for type safety💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!