-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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]: v7 -> v8 controls tab is missing a lot of information #26496
Comments
It seems the autodocs shows only the args that you use in your first story or defined is the Meta object. All args are not displayed by default anymore. Try to add and set a value in one of your stories you will see it. But for the controls options the problem occurs since they switch from react-docgen-typescript to react-docgen by default. A curious choice... |
@Astarosa explained why you see just an arg, but there are still issues with Description, Default and Control. I managed to get back my Descriptions (which I wrote as JSDocs to my interfaces) by switching to the old |
Thanks for reporting this. We switched to using |
For some reasons controls are broken since V8. Change the version of |
Hey! This issue happened to me too, luckily switching to |
Having the same issue after upgrading to 8.0.4 from 7.6.17 :( |
I'm facing the same issue. It's also hiding the type descriptions. I can manually add them by adding argtypes.field.description but it would be nice if this would be auto generated. |
Update: I just found out that I did not configure reactDocgen correctly in the main.ts. It must be
With this, I can confirm that the documentation is generated properly. |
I noticed that with |
Same for me. When using |
There is some stuff that I found out recently, that might help somebody. When using export const Button = forwardRef<'button', ButtonProps>((props: ButtonProps) => { Even if the second The declaration of props have to be in a plain interface with no magic: export interface ButtonProps {
color?: 'primary' | 'error';
} This works as expected. But in one big project I use polymorphic components and the props are not declared using a simple interface, they are defined like this: export interface ButtonOwnProps {
color?: 'primary' | 'error';
}
export interface ButtonTypeMap<C extends React.ElementType = 'button', P = {}> {
defaultAs: C;
props: P & ButtonOwnProps;
}
export type ButtonProps<
C extends React.ElementType = ButtonTypeMap['defaultAs'],
P = {},
> = OverrideProps<ButtonTypeMap<C, P>, C>; This was working with v7 but does not work with Storybook 8 anymore. Storybook config in main.ts: For one project I was using addons: [
'@storybook/addon-a11y',
{
name: '@storybook/addon-essentials',
options: {
docs: false,
},
},
], In v7 this was fine, but if you use the same in Storybook 8 no controls show up. Also it's not needed anymore, so just remove it or set |
* chore: move to storybook 8 * chore: replace storybook-tailwind-dark-mode with @storybook/addon-themes * chore: use react-docgen-typescript instead of react-docgen https://storybook.js.org/blog/storybook-8/#improved-react-and-vue-control-autogeneration https://storybook.js.org/docs/api/main-config-typescript#reactdocgen storybookjs/storybook#26496 * chore: upgrade eslint-plugin-storybook
… much fewer changes See storybookjs/storybook#26496
Hi there! Thank you for opening this issue, but it has been marked as |
I'm afraid we need to close this issue for now, since we can't take any action without the requested reproduction or additional information. But please don't hesitate to open a new issue if the problem persists – we're always happy to help. Thanks so much for your understanding. |
Can we get this issue re-opened? As this issue still persists. I am using forwardRef components, and the only way to get For additional context, I expect: export const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {...} to show the correct prop descriptions. |
* WIP: Try upgrading the react types and working through errors Here's the summary of errors we're starting with: ``` Found 109 errors in 28 files. Errors Files 4 packages/design-system/src/components/Accordion/Accordion.stories.tsx:8 3 packages/design-system/src/components/Alert/Alert.stories.tsx:6 1 packages/design-system/src/components/Autocomplete/utils.tsx:15 11 packages/design-system/src/components/ChoiceList/ChoiceList.stories.tsx:7 4 packages/design-system/src/components/Drawer/Drawer.stories.tsx:29 12 packages/design-system/src/components/Dropdown/Dropdown.stories.tsx:8 6 packages/design-system/src/components/Dropdown/Dropdown.tsx:171 1 packages/design-system/src/components/Dropdown/DropdownMenuOption.tsx:66 5 packages/design-system/src/components/HelpDrawer/HelpDrawer.stories.tsx:29 4 packages/design-system/src/components/IdleTimeout/IdleTimeout.stories.tsx:10 4 packages/design-system/src/components/PrivacySettingsDialog/PrivacySettingsDialog.stories.tsx:17 6 packages/design-system/src/components/Spinner/Spinner.stories.tsx:6 23 packages/design-system/src/components/TextField/TextField.stories.tsx:10 2 packages/design-system/src/components/Tooltip/Tooltip.tsx:357 1 packages/design-system/src/components/UsaBanner/UsaBanner.stories.tsx:5 1 packages/design-system/src/components/web-components/ds-accordion/ds-accordion.tsx:22 1 packages/design-system/src/components/web-components/preactement/define.test.tsx:35 1 packages/docs/src/components/content/ContentRenderer.tsx:111 1 packages/docs/src/components/content/EmbeddedExample.tsx:17 2 packages/docs/src/components/layout/SideNav/SideNav.tsx:25 2 packages/docs/src/components/layout/TableOfContents.tsx:43 1 packages/docs/src/components/page-templates/BlogPage.tsx:18 1 packages/docs/src/pages/blog.tsx:33 2 packages/ds-healthcare-gov/src/components/Accordion/Accordion.stories.tsx:8 2 packages/ds-medicare-gov/src/components/Card/Card.stories.tsx:6 5 packages/ds-medicare-gov/src/components/HelpDrawer/HelpDrawer.stories.tsx:31 1 packages/ds-medicare-gov/src/components/SimpleFooter/SimpleFooter.stories.tsx:6 2 packages/ds-medicare-gov/src/components/Stars/stars.stories.tsx:6 ``` * Fixing the first batch of errors (down to 89 from 109) * Remove custom docs config for Drawer storybook page and fix VRTs Add new interaction VRTs for dialog and drawer, and don't have any of the stories open them automatically * Trying to fix missing Drawer story controls but failing I was hoping fixing these types would do it. * Ignore errors coming from react-aria types * Two different ways of getting around the errors for inlining the doc page JSX * Down to 24 errors * Finished fixing all the errors in the core package (down to 20 now) * Huh, the errors just go away after making some edits to the yarn lockfile I think I'll go back and undo some of my previous commits to see if I need them * Just realized there was some dead code in here * Revert "Ignore errors coming from react-aria types" This reverts commit f4fac88. * Revert more of the react-aria changes This reverts part of commit ffc035d. * I can revert this change too * Oh no, these new arg tables do not look good It seems as though the type inference has gotten worse in this version. Instead of the type for Badge `size` being listed as `big` (only supports big), it is now reported as `literal`. For `string | React.ReactNode`, it only says `union`. Instead of `type` being `checkbox` and `radio`, it’s `union`. Instead of `ReactNode` for `React.ReactNode`, it prints out as `ReactReactNode` * Revert "Oh no, these new arg tables do not look good" This reverts commit 6811f4b. * Changing the default settings to use the typescript docgen results in much fewer changes See storybookjs/storybook#26496
* bump storybook to latest packages * update storybook files using SB migration scripts * use correct markdown comment structure * replace ArgsTable with ArgTypes - seems to work * Fix reading of story files from tests * Fix old references to `ArgsTable` * [NO-TICKET] Upgrade React types to fix Storybook 8 branch (#3080) * WIP: Try upgrading the react types and working through errors Here's the summary of errors we're starting with: ``` Found 109 errors in 28 files. Errors Files 4 packages/design-system/src/components/Accordion/Accordion.stories.tsx:8 3 packages/design-system/src/components/Alert/Alert.stories.tsx:6 1 packages/design-system/src/components/Autocomplete/utils.tsx:15 11 packages/design-system/src/components/ChoiceList/ChoiceList.stories.tsx:7 4 packages/design-system/src/components/Drawer/Drawer.stories.tsx:29 12 packages/design-system/src/components/Dropdown/Dropdown.stories.tsx:8 6 packages/design-system/src/components/Dropdown/Dropdown.tsx:171 1 packages/design-system/src/components/Dropdown/DropdownMenuOption.tsx:66 5 packages/design-system/src/components/HelpDrawer/HelpDrawer.stories.tsx:29 4 packages/design-system/src/components/IdleTimeout/IdleTimeout.stories.tsx:10 4 packages/design-system/src/components/PrivacySettingsDialog/PrivacySettingsDialog.stories.tsx:17 6 packages/design-system/src/components/Spinner/Spinner.stories.tsx:6 23 packages/design-system/src/components/TextField/TextField.stories.tsx:10 2 packages/design-system/src/components/Tooltip/Tooltip.tsx:357 1 packages/design-system/src/components/UsaBanner/UsaBanner.stories.tsx:5 1 packages/design-system/src/components/web-components/ds-accordion/ds-accordion.tsx:22 1 packages/design-system/src/components/web-components/preactement/define.test.tsx:35 1 packages/docs/src/components/content/ContentRenderer.tsx:111 1 packages/docs/src/components/content/EmbeddedExample.tsx:17 2 packages/docs/src/components/layout/SideNav/SideNav.tsx:25 2 packages/docs/src/components/layout/TableOfContents.tsx:43 1 packages/docs/src/components/page-templates/BlogPage.tsx:18 1 packages/docs/src/pages/blog.tsx:33 2 packages/ds-healthcare-gov/src/components/Accordion/Accordion.stories.tsx:8 2 packages/ds-medicare-gov/src/components/Card/Card.stories.tsx:6 5 packages/ds-medicare-gov/src/components/HelpDrawer/HelpDrawer.stories.tsx:31 1 packages/ds-medicare-gov/src/components/SimpleFooter/SimpleFooter.stories.tsx:6 2 packages/ds-medicare-gov/src/components/Stars/stars.stories.tsx:6 ``` * Fixing the first batch of errors (down to 89 from 109) * Remove custom docs config for Drawer storybook page and fix VRTs Add new interaction VRTs for dialog and drawer, and don't have any of the stories open them automatically * Trying to fix missing Drawer story controls but failing I was hoping fixing these types would do it. * Ignore errors coming from react-aria types * Two different ways of getting around the errors for inlining the doc page JSX * Down to 24 errors * Finished fixing all the errors in the core package (down to 20 now) * Huh, the errors just go away after making some edits to the yarn lockfile I think I'll go back and undo some of my previous commits to see if I need them * Just realized there was some dead code in here * Revert "Ignore errors coming from react-aria types" This reverts commit f4fac88. * Revert more of the react-aria changes This reverts part of commit ffc035d. * I can revert this change too * Oh no, these new arg tables do not look good It seems as though the type inference has gotten worse in this version. Instead of the type for Badge `size` being listed as `big` (only supports big), it is now reported as `literal`. For `string | React.ReactNode`, it only says `union`. Instead of `type` being `checkbox` and `radio`, it’s `union`. Instead of `ReactNode` for `React.ReactNode`, it prints out as `ReactReactNode` * Revert "Oh no, these new arg tables do not look good" This reverts commit 6811f4b. * Changing the default settings to use the typescript docgen results in much fewer changes See storybookjs/storybook#26496 * update vrt snaps, drawer stories renamed * [NO-TICKET] Use new docgen union sorting (#3166) * Use the new beta version of `react-docgen-typescript` that has union-member sorting Right now I'm trying to figure out why the prop table on the Drawer page isn't rendering * The arg table was gone because it wasn't included in the template * Update VRT changes from this branch with underline style changes from `main` * Go back to the Drawer story setup from c930062 In the interaction tests, we were trying to use features of the story (the toggle) that didn't exist, which is why they were failing. I think the original reason I changed the drawer stories was to make them consistent with the dialog stories, and I was also able to consolidate them down to one. That necessitated the interaction tests because the drawer was no longer open by default for a screenshot to be taken. --------- Co-authored-by: Patrick Wolfert <patrick.wolfert@adhocteam.us>
Describe the bug
v7: (7.6.17)
![image](https://private-user-images.githubusercontent.com/1649903/312860218-445248c8-796a-4f4b-a265-9a0eeda29a50.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE5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gtQW16LURhdGU9MjAyNDA3MjZUMDQyNTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjFkOTMyYWU1NWQ2Y2I4OGVlYzIyMGFkZWIzNzI3NTNmNTM4ODIzNDY5ZWI5NTc4NjE0MzczMDBjYmRkMzQ1NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.HyHDZiqfIS-E4Ripsk9fkzkroa0SWmGlk72UaqbJQyo)
To Reproduce
Removed a LOT of bloat, but this should do:
System
Additional context
Switching between the two versions (and restarting storybook dev) is enough to trigger this issue - config and code remains untouched
The text was updated successfully, but these errors were encountered: