-
-
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
[Bug]: Storybook v7 does not populate JSDoc annotations in ArgsTable
for memoized TypeScript components
#21192
Comments
Thanks for the detailed report. We're going to be taking a hard look at the way we extract argTypes in 7.x, so hopefully we can fix a bunch of the outstanding issues then. Cc @KrofDrakula |
For the record, I can confirm that in Storybook v7.0.2 the bug still exists. Any info @shilman when this might be fixed? Thanks |
hi is there a fix on this already? or a work around? |
Can you try out the following canary in your project and let me know whether it resolves any of your issues (or generates new ones)? We're looking to switch the default docgen from Note that the change is currently only for Vite projects Instructions in the "how to test" section: 👉 #23825 |
hi, for some reason the autodocs is now working properly, as we are using storybook 7.2.2 , saves me the hassle of manually adding the description of each props on stories.. when i comment on my props on main file it works now.. |
That's great to hear. Closing this for now. Please let me know if there's more to be done here! |
Describe the bug
Storybook v7 does not auto populate JSDoc annotations as
ArgsTable
descriptions for memoized TypeScript components.In v6, the
ArgsTable
does not populate at all for memoized TS components that aren't default exports. Which was a bug in Storybook for React components in 2020 and was resolved in this commit: ee4144a.I upgraded to v7 to see if this was fixed, and it partially of is. The
ArgsTable
does populate. However the JSDoc annotations still don't show up unless the original component is the default export or named export. If I memoize the component and then export as a default or named (aliased) export, then the JSDoc annotations don't show up.The problem is not the memoization itself, but that Storybook requires the component to be exported at some point in the file without any form of alias.
There have been quite a few posts about named exports, memoization, and react-docgen vs react-docgen-typescript. What I mentioned that was happening in v6 was considered a known bug. That bug seems to be fixed in v7, but not completely.
As of right now to solve this, I have to add an additional non memoized default export that is dead/orphaned code. That export that will never be imported anywhere. It's just a hack for Storybook documentation.
I am using the latest v7, which is 7.0.0-beta.50 as of today. I am also using Windows 11, so not sure why it says Windows 10 when I run
npx sb@next info
.To Reproduce
✅ Default export without memoization
This does auto populate JSDoc annotations in the
ArgsTable
.✅ Named export without memoization
This does auto populate JSDoc annotations in the
ArgsTable
.⛔ Default export with memoization
This does not populate the JSDoc annotations. This does work for React components, but just not TypeScript components.
⛔ Named export with memoization
This also does not populate JS Doc annotations in
ArgsTable
.✅ Dead export
This works, but now I'm exporting something only for the sake of getting JSDoc annotations to show up in Storybook.
System
Additional context
No response
The text was updated successfully, but these errors were encountered: