-
-
Notifications
You must be signed in to change notification settings - Fork 9.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
[Bug]: Addon being forced to use React v16.14.0 in storybook 7 (v18 worked in 6) #22217
[Bug]: Addon being forced to use React v16.14.0 in storybook 7 (v18 worked in 6) #22217
Comments
I've got a workaround for this:
(can see it on the PR linked above) Isn't nice though, so obviously I'd rather not have to do it |
This seems like a limitation of the new manager bundling. I can't imagine why it worked in previous versions. This will be fixed by #21673 |
I think previously it must have been using whichever version of React was around to build the components in the storybook, the storybook itself & the addons. Even though the storybook was asking for React 16, that’s the only way it could have been working before I think |
I also encountered the same problem, my hook is invalid, I do not know who came from react16, anyone to deal with this problem? |
@daniel-stoian-lgp maybe this, |
Describe the bug
In previous versions of storybook the
import React from "react"
in my register.tsx would find version 18 as expected, but now it seems to be givenv16.14.0
.https://github.com/neil-morrison44/storybook-addon-recoil-flow/blob/073490700fdca76c24593d6e4009238426b53777/src/register.tsx#L6
v16 doesn't appear at all when doing
npm list react
(allreact@18.2.0
) so I'm really not sure where it's coming from (I know storybook pre-bundles itself now so I'm guessing it could be that?)I've tried using esbuild to pre-bundle my addon but I get
Rule of Hooks
warnings about different versions of React (which makes sense, I guess)I'm using
react-three-fiber
which needs to use React 18 features (useId
is the first one it'll error on)Thanks
To Reproduce
The storybook can be found in my draft PR for updating to storybook 7: neil-morrison44/storybook-addon-recoil-flow#4 (it's pretty much a new storybook + the addon)
Though, if I do manage to find a workaround in the interim you'll want the one from this commit: https://github.com/neil-morrison44/storybook-addon-recoil-flow/tree/073490700fdca76c24593d6e4009238426b53777
System
Additional context
neil-morrison44/storybook-addon-recoil-flow#4 (PR link again, if I happen upon a workaround it'll be there)
The text was updated successfully, but these errors were encountered: