-
-
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
addon-info: Component.__docgenInfo not defined. #1762
Comments
I am pretty sure this is caused by react-docgen not being setup like it used to be. If I manually add my own Docs.__docgenInfo = {
'description': 'A dumb component that says "hello"',
'methods': [],
'props': {
'name': {
'type': {
'name': 'string'
},
'required': false,
'description': 'the name of the person to say "hello" to',
'defaultValue': {
'value': "'World'",
'computed': false
}
}
}
} |
@danielduan Did this change recently? |
Honestly, I haven't really looked at it since it was working when I worked on it with @bigassdragon. I think it could be related to the move from @kadira to @storybook, but I'm not sure. If I look at the webpack config (in a custom config function) I don't see any of the react-docgen stuff I might expect, but I don't know what it used to look like. |
You actually don't need I'm guessing that might have cleared the docgen info. |
I tried it without, too. |
If you're using a custom webpack config, make sure that you're importing the storybook defaults as well if you're in full control mode. We've changed a good amount of the Webpack between v2 and now, you might not need a custom webpack file unless you're adding additional loaders. The webpack config gets read here: Docs on webpack config: |
No custom webpack-config (although I did try it with one in full-control mode.) Here is a project that demonstrates the issue. As I said, it's pretty much just a plain |
If you delete Part of me wonders why we're even parsing the AST of the files in the babel plugin because |
Yep, that fixed it. Thanks for the help! It's a bit frustrating though, because I like to export the Component (for unit-testing and storybook) and export the react-redux-wrapped version (for actual use in my application.) I generally do it like this: import React from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
/** A dumb component that says "hello" */
export const Docs = ({name}) => (<div>Hello {name}</div>)
Docs.propTypes = {
/** the name of the person to say "hello" to */
name: PropTypes.string
}
Docs.defaultProps = {
name: 'World'
}
export const mapStateToProps = state =>({})
export default connect(mapStateToProps)(Docs) I'll take a look and submit a PR over at babel-plugin-react-docgen. Thanks again! |
Yeah, you can export it after as a workaround, something like:
Closing issue because this is really a docgen plugin problem. Please reopen if there's something else that hasn't been addressed. |
Thanks! |
I made a PR to change the behavior of the resolver but as @danez pointed out, the resolver is actually configurable, and there are a few built in (maybe |
Think it's a good idea, let's keep the conversation in the other issue for the babel plugin. |
I can't get the "description" field to show up in the PropType table in my project. I worked on #1030 with @bigassdragon and we had it working when all was done.
I tried with both methods to add info, and
.__docgenInfo
is undefined in both.I did this in my config.js:
and made stories that looked like this:
and
Docs.js
looks like this:I tried
class Docs extends React.Component
style, too.Still no "description" field in either story:
steps to reproduce:
Then I made changes, above.
The text was updated successfully, but these errors were encountered: