Skip to content
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]: Can no longer render prop documentation without a control #26484

Closed
bdpartridge opened this issue Mar 13, 2024 · 7 comments · Fixed by #26567
Closed

[Bug]: Can no longer render prop documentation without a control #26484

bdpartridge opened this issue Mar 13, 2024 · 7 comments · Fixed by #26567

Comments

@bdpartridge
Copy link

Describe the bug

In version 8.0.0, it's no longer possible to render a prop's documentation in the controls table without a control. This was working in version 7.6.5.

To Reproduce

This is very easy to reproduce in 8.0.0, but I can link to a reproduction if it's really necessary. Simply try to disable the control for a prop as noted in the documentation:

// Replace your-framework with the name of your framework
import type { Meta } from '@storybook/your-framework';

import { YourComponent } from './YourComponent';

const meta: Meta<typeof YourComponent> = {
  component: YourComponent,
  argTypes: {
    // foo is the property we want to remove from the UI
    foo: {
      control: false,
    },
  },
};

export default meta;

In 7.6.5, no control was rendered in the table. In 8.0.0, a control for whatever type is inferred is shown.

System

Storybook Environment Info:

  System:
    OS: macOS 14.2.1
    CPU: (12) arm64 Apple M2 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - ~/projects/fwd/.gradle/nodejs/node-v18.17.1-darwin-arm64/bin/node
    npm: 9.6.7 - ~/projects/fwd/.gradle/nodejs/node-v18.17.1-darwin-arm64/bin/npm
    pnpm: 8.7.6 - ~/projects/fwd/.gradle/pnpm/pnpm-v8.7.6/bin/pnpm <----- active
  Browsers:
    Chrome: 122.0.6261.112
    Edge: 122.0.2365.80
    Safari: 17.2.1
  npmPackages:
    @storybook/addon-essentials: 8.0.0 => 8.0.0 
    @storybook/addon-links: 8.0.0 => 8.0.0 
    @storybook/addon-svelte-csf: 4.1.2 => 4.1.2 
    @storybook/svelte: 8.0.0 => 8.0.0 
    @storybook/svelte-vite: 8.0.0 => 8.0.0 
    storybook: 8.0.0 => 8.0.0

Additional context

No response

@federico-ntr
Copy link

Having this issue too. Since some issues with autodocs are caused by the new Docgen (react-docgen instead of react-docgen-typescript) I tried to switch to the old Docgen but I still cannot disable controls

@Astarosa
Copy link

So who is responsible of this breaking change ? Facebook or Storybook ? From what we discussed here #26496 and the fact that i have a similar problem with Vue too i would say it's a on the storybook side but i may be wrong.

@vanessayuenn
Copy link
Contributor

Thanks for reporting this! FYI @Astarosa @federico-ntr this is a regression in the controls addon, unrelated to the docgen changes.

@valentinpalkovic
Copy link
Contributor

Hi @bdpartridge,

Thank you for reporting the issue.

I have actually troubles to understand it, though. If you want to remove a specific argType row from the argType table, use argTypes.<yourArg>.table.disable = true instead of argTypes.<yourArg>.control = false like documented here: https://storybook.js.org/docs/api/arg-types#tabledisable.

Also, I don't understand this sentence:

it's no longer possible to render a prop's documentation in the controls table without a control

What do you mean by that? Could you please give some more detailed example?

@federico-ntr
Copy link

@valentinpalkovic I think they mean keeping the row in the table but with control disabled, like documented here (second example, prop documentation without control): https://storybook.js.org/docs/essentials/controls#disable-controls-for-specific-properties

@valentinpalkovic
Copy link
Contributor

@federico-ntr
Aha! That information was indeed the missing piece. I'll take a look :)

@bdpartridge
Copy link
Author

@federico-ntr Yes, that's exactly what I was referring to. Thanks for clarifying.

@valentinpalkovic Sorry, I should've made that clearer in the description. Thanks for picking up this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants