-
-
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]: Using typescript: "react-docgen-typescript" breaks source preview #26510
Comments
@adrianaferrugento looks like this issue can be mitigated by using |
It can, but for me I lose a lot of type details when using So now I have to choose between better types in the controls, or nice code in the examples, which is a bit of a bummer. |
I actually get some errors when I try to use it with my configuration for some reason. I don't think it's a storybook issue because it works in the reproduction link but if anyone has any ideas let me know. Also losing the type details would be a bit annoying so my preferred solution would be to use |
Same issue and started cropping up around the time of RC5. Using either react-docgen or react-docgen-typescript. Are you guys in a monorepo? I tried to reproduce outside of my project in a clean install and couldn't. |
Pretty much narrowed it down to the 8.0.0-rc.4 package of @storybook/react. If you downgrade it to rc3 for that package, clear all caches (browser + delete node_modules and run Maybe this PR: #26382 ? EDIT: be sure to pin it to 8.0.0-rc.3 (no ^) |
Tried with |
Opened duplicated 26538 to report same issue. Had to downgrade both Much thanks to all involved with the fix ! |
Will be fixed with #26566 |
Hey everyone! This issue is solved in #26566 and will be released soon. Thanks for your patience 🙏 |
Thank you so much @yannbf! |
Thanks @yannbf. I know this deserves a new issue (and I will later when I have time), but the fix resulted in problems with the control display. See the screenshot. React element objects are displayed instead of something like a set object button: This is using the default react-docgen. |
Hey there, I think this has always been the case, as a current limitation of how controls are showing JSX elements. Can you show a reproduction where it behaved differently? |
Hey thanks for the reply. Honestly, I am having a lot of issues in general with the autodocs. I would normally be happy to take the time to file bugs and even do a repro, but I've spent so much time on it that I've had to switch gears. To be fair I don't doubt it's tough on your end when you don't have control of the main dependency (react-docgen). With how things are right now in this project, I'll either have to either have an argType for most/all args with various overrides or it might just be easier to create mdx pages with manual prop tables. But I'm still very appreciative about Storybook in general. Thanks for all you do! Edit: the issue wasn't just with LinkTo, it does seem to be consistent when using JSX/React Elements as args. However as an aside, I am sometimes getting this when providing the arg as a component instead (these props are designed to take either React.ReactNode or ComponentType: After poking at this just a little more, I now see that I get something different in the control cell when an arg is provided, vs. a default value... even when the arg is the same type as the default value. Example with a default value but no arg: Same prop but this time with an arg Sorry again for adding all this to a closed issue, but I original thought the fix to this one might have changed behavior (turns out that I changes some args around the same time...). All in all it sounds like maybe we have different expectations for what the UX should be, or at least what is worth doing given the challenge. IMO, if a proper control that looks good and makes sense to the user can't be displayed then nothing (or some message stating such) should be displayed. |
Describe the bug
Using the following in my main config breaks the preview source code.
To Reproduce
https://stackblitz.com/edit/github-cuvfy3?file=.storybook%2Fmain.ts
System
The text was updated successfully, but these errors were encountered: