-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 Preact story rendering breaks when using hooks to declare state in stories #13928
Comments
By design hooks have to rely on singletons to work. We've seen some setups where webpack was bundling multiple versions of Preact for some reason. Just a wild guess, but may be worth to check. |
@marvinhagemeister in |
@shilman yup, that would fix it. The component constructor needs to be called and instanciated by Preact so that it sets up the necessary pointers for hooks to work. |
It looks like there's a problem in the preact kitchen sink app. In
This installs After fixing this problem, the next step will be solving the original hooks problem mentioned in this issue. |
Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.0-alpha.1 containing PR #14473 that references this issue. Upgrade today to the
|
Sweet! Thanks. |
Describe the bug
Using
preact/hooks
inside of story functions breaks Storybook for Preact story rendering.To Reproduce
The following story errors out:
If you declare state in another function as a functional component, the story works:
Expected behavior
There's no clear indication in the documentation that that might not be allowed. It might be worth mentioning that somewhere in Writing Stories sections.
Screenshots
N/A
Code snippets
See above.
System
The
npx sb@next info
command fails because of integrity checks, but I am usingStorybook 6.1.17
.Additional context
None.
The text was updated successfully, but these errors were encountered: