-
-
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
Prop table broken in 5.3.2 with propTypes #9415
Comments
The props table in 5.2 had two different code paths. One that used The updated code in 5.3 does not have the fallback path. Since you're not seeing the props at all, I'm guessing that you've overriden your babel settings and |
I have same problem here, after upgrade to I'll try look in babel settings |
@patricklafrance I think technically this was a breaking change and we should consider adding back the fallback code for 5.3, and then removing it in 6.0. WDYT? |
Thanks for the helpful explanation @shilman, it explained why it was working before and I realized that we actually hadn't previously added that as a dependency as it had worked without it. @danilovaz I fixed by adding |
Its'a an option @shilman , I dont like it though. It shouldn't have ever work without the proper babel plugin setup and it's an easy fix for the user. If we had back the fallback, I fear we might end up with weird issues that might take a lot of our time to figure out what's happening. Could we instead update the error message to suggest to configure properly the babel plugin required by the props table? |
@patricklafrance Ok better error message is an improvement. I just think going from something that kind of works to something that doesn't work at all would be a terrific disappointment for users, and we've seen that happen again and again since that change... |
@shilman I understand. I guess it only happens to the TypeScript users? Since with 5.3 react-docgen is added out of the box. Could we add the typescript loader to the doc preset by default? Maybe then it will solve it for MOST of the users? If you don't use presets and have a fully customized webpack setup, I guess you can expect to make a few changes to your config between versions. |
@patricklafrance That happens with my React project and I don't use TypeScript 😢 |
@danilovaz that's weird! How is it possible @shilman ? |
@patricklafrance really weird! 😞 before An example of my proptypes
|
@danilovaz Do you have a custom babel config? I'm having similar issue and noticed that if I axed my custom babel config the props table started working again. Problem then is that I can't build storybook. I can only run it locally. Here's my
As soon as I remove it prop tables work again. UPDATE: Those having the same issue. I solved it by adding a blank |
@danilovaz When I add a blank .babelrc I get a json parse error. |
5.3.6, broken as well. I have tried to install I also have remarked that console.log(ComponentName.__docgen) yields nothing when included at the end of the file where the component is defined (after the export). |
Try copying your babel config in your root to your I think this fix is also now broken in 5.3.6 |
If your component doesn't have any docgen info then, for sure it will not work. There are a few possibilities:
You can see the final webpack configuration that storybook is running on your files with:
|
@patricklafrance THanks, Patrick, unfortunately this didn't work. I write components in ES (before webpack/babel) and stories in js (not mdx) =>
As you can see, the docgen plugin is actually loaded. I have tried, without much understanding, to copy my My presets file Also I noticed My components are all generated with this template (inside a yeoman generator): https://github.com/fwrlines/generator-react-component/blob/master/generators/app/templates/Component.js My stories look all like this (also generated with yeoman) : I have tried with Class Components as well. In 5.2.8 this was half working : the propotypes table and defaults were detected and appeared in storybook docs, but the description of each prop didn't show at all. Now I only have a "No props found for this component" message for every component. Edit
Edit 2 : fixed it, unknowingly
Edit 3 : found the source of the bug I was doing this :
Instead of
In files where components are defined For a weird reason, Storybook 5.3 voids the contents of the docgen when using the first option, independently of where the dynamic import is in the file |
I have the same issue, but i don't use the import() syntax. |
@779g I'm confused about your config above. The docgen plugin needs to run on your components, not your stories, so the rule you've included isn't valid. It's great that you solved your problem, but I just want to point that out in case it saves other people headaches. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Could you please paste your webpack config? Note: was able to get it to work by adding this into the config.module.rules
|
FYI, the 6.0 typescript recommendations have been updated here. I don't know whether it will fix this issue, but it's been pretty good in a lot of cases: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-prop-tables-with-typescript |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
I have same problem here in version 5.3.18. |
@supersnager do you have a repro? |
@shilman unfortunately no. My project is quite complex, and it's impossible to share it now. |
@shilman Not prepared repro yet, but found, that props are not displayed only when component is imported to story from package (node_modules). |
@supersnager Yeah that's a big hint. Storybook doesn't support props from an installed package yet! 😄 |
@shilman Will you plan to support props from installed package in future? |
@artemAp yes, if it’s even possible. A lot of the information we need might already be stripped out of the published package. At any rate, we’re still stabilizing the current props table for now |
@shilman Thank you, that explains a lot ;) Any workaround? |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
I found workaround. Just added custom webpack configuration:
|
Another possible reason why props table is not generated can be class component. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook! |
Describe the bug
On upgrading to 5.3.2, any props defined with
propTypes
are not building the prop tableTo Reproduce
Declare propTypes for a component. Open storybook and see that it hasn't generated a prop table.
Expected behavior
Expected to see prop information
Screenshots
Before
After upgrading
Code snippets
System:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: