hipstersmoothie / react-docgen-typescript-plugin

A webpack plugin to inject react typescript docgen information
MIT License
68 stars 28 forks source link

displayName causing __docgenInfo not to be generated #51

Closed leepowelldev closed 1 year ago

leepowelldev commented 3 years ago

Not 100% sure if this is an issue caused by this plugin. But I have a component which has a displayName set differently to the variable name it's assigned to - as it's a sub-component:

const Item = () => {...}
Item.displayName = 'List.Item'; 

// or

Item.displayName = 'ListItem'; 

And when I used a display name like this then no docgen data gets attached to the component. However if I do either of the following:

// Set displayName to match the variable name
const Item = () => {...}
Item.displayName = 'Item'; 

// or have no displayName
const Item = () => {...}

Then it works as expected. I'm seeing the problem in Storybook, which seems to read the __docgenInfo property this plugin creates, so I don't think it's an issue in Storybook, and the react-docgen playground doesn't seem to have an issue generating the docs - so I'm assuming it might be this plugin.

Is there anything you can think of in the code that might be causing something like this to happen?

jpiggg commented 2 years ago
otterp012 commented 1 year ago

I had the same problem

github-actions[bot] commented 1 year ago

:rocket: Issue was released in v1.0.5 :rocket:

github-actions[bot] commented 1 year ago

:rocket: Issue was released in v1.0.5 :rocket: