-
-
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
React hooks error with material-ui #6848
Comments
Are you using react hooks somewhere in your code? |
No, but this error doesn`t occure if I use this component without storybook |
OK, I'll take a look at your repo |
Investigating... Seems the problem is with how addon-info (storybook) + withStyles (@material-ui/core/styles) interop. |
This line seems to cause react to think it's not rendering a functional component, which is what hooks needs to operate. extract(innerChildren.type.render(innerChildren.props)); |
Found a fix, opened a PR |
Hi @ndelangen , Thanks |
@ndelangen I'm having the same issue. Do you know when this PR will be merged? Is there any work around until then? maybe lowering the react version? I tried, but didn't work. |
Same here after upgrade to material-ui V4 everything is broken. |
I just ran into this as well. Seems the workaround for the time being is to stop using withInfo decorator until it's fixed. I think I got a few other components working by removing withStyles from the tree but can't really do that everywhere at this time so I just commented out the withInfo add decorator line in my config and am going forward with that for now. |
I am not sure this is the best place to ask this question, but anyway, can I use |
Yowza!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-rc.3 containing PR #6859 that references this issue. Upgrade today to try it out! Because it's a pre-release you can find it on the Closing this issue. Please re-open if you think there's still more to do. |
I tried it and I still get the same error, my devDeps look like this:
|
@shawnmclean @DwayneSamuels could you help me reproduce? a list of dependencies isn't enough for me to be able to reproduce unfortunately. I was able to reproduce before using @alexnofoget repo, before, but the fact you're still experiencing an issue, suggest your issue might have a different cause. |
I just tried the new code with the 5.1.1 release and I am no longer seeing the error, so this is fixed for us now. |
I'm not sure that my problem is same as this. But I see similar error then I'm trying to run tests in cypress using storybook v. 5.3.9. But there is no errors then I run storybook alone, without tests. So this is only one issue that seems like my problem I could find. Does anyone here know anything about it? |
@XanderSpecter share more about your setup (config + a failing test?) and somebody can help? |
@shilman I didn't make configs in that project. So, I don't know, that configs I need to share :( I have a story for component:
Now I'm importing TextField from metarial without my wrapper because I'm trying to solwe this problem thiwhout my code. Also I have a spec for cypress that connects to storybook using this empty story and trying to render component and run tests:
If you need more information please say what configs I need to share. And sorry about my bad English :) |
Hmm, sorry I'm not sure. Maybe somebody else knows? |
That scheme of tests works with another components that not using material-ui. But with material test runs, sucsessfully connects to storybook, try to render and throw same error as in topic of this issue |
I have an error with storybook and react hooks
Example with the same error here https://github.com/alexnofoget/storybook-issue
The text was updated successfully, but these errors were encountered: