Skip to content
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

addon-docs Prop Table versioned React components 'No props found for this component' #10771

Closed
christinec01 opened this issue May 13, 2020 · 6 comments

Comments

@christinec01
Copy link

If you are reporting a bug or requesting support, start here:

Bug or support request summary

Following the Storybook setup instructions for adding Docs to my Storybook project which uses React components. After adding '@storybook/addon-docs' to my main.js file, and ensuring that my component field is correct

import { Radio } from './radio/radio';

export default {
  title: 'Controls|Radio',
  component: Radio,
};

The Docs tab loads and the component renders, however the props table and code snippet are unavailable.

image

Steps to reproduce

This is a private repo so STR is difficult, but I'm not using anything 'custom' outside of the standard set up outlined in the addon-docs instructions.

Please specify which version of Storybook and optionally any affected addons that you're running

  • @storybook/react 5.3.8
  • @storybook/addon-something 5.3.18

Thanks and please let me know if I need to provide any further detail!

@shilman
Copy link
Member

shilman commented May 13, 2020

  • Does Radio.__docgenInfo exist?
  • Is your component written in Typescript or PropTypes?
  • Are you using a custom webpack setup? Custom babel setup?

Can you create a standalone repro, perhaps using @yannbf 's template? https://gist.github.com/yannbf/d7a32cfe697e71489db00bfd50e7ab5c

@christinec01
Copy link
Author

christinec01 commented May 18, 2020

Thanks for the fast reply!

  • Radio.__docgenInfo does not exist
  • My component is written in React with PropTypes and is published, then imported into the App running Storybook
  • I am using some custom Webpack configuration and babel setup - comparing the output of my project's webpack config with what I see in the Storybook docs, one difference is the loader used. My project is using babel-loader-8, is there a requirement for a different babel version?

I can't really recreate with the template you provided because of the privacy issue, however, I can share the output --debug-webpack if that would help?

I'm trying to trace the error - it looks like its coming from a Preview.js file

image

@christinec01
Copy link
Author

Update: I was reading through this thread and thought perhaps my issue might be related - I downgraded my project's version of @storybook/addon-docs to v5.2.0 and am now seeing a props table with prop data, so I imagine adding babel-plugin-react-docgen as a dev dependency and adding react-docgen to my babel-loader should do the trick, however, my code snippet preview is still missing (though this may warrant a separate issue)

Screen Shot 2020-05-18 at 5 44 05 PM

Out of curiosity, why wasn't the removal of the fallback code path justification for a breaking change in the storybook/addon-docs package?

@shilman
Copy link
Member

shilman commented May 19, 2020

@christinec01 currently props tables only work for components defined in your app/library. by the time the components are published to NPM, most the useful information has been stripped out. it's an important use case, so we'll need to figure it out, but for now we're just getting all the basics working smoothly.

Re: the breaking change, we release version all core packages in sync, and we typically make one major release per year in an attempt to minimize disruption to our users. Storybook is a complex system with hundreds of contributors, so sometimes small breaking changes slip through the cracks. In this particular case, we felt that the fallback code was typically masking user babel/webpack configuration problems and adding more confusion / support burden. It partially enables your use case of props tables for "external libraries", which I don't think we considered in the decision because we don't officially support that.

@shilman shilman added the react label May 23, 2020
@stale
Copy link

stale bot commented Jun 13, 2020

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!

@stale stale bot added the inactive label Jun 13, 2020
@stale
Copy link

stale bot commented Jul 13, 2020

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!

@stale stale bot closed this as completed Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants