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

Global argTypes table.category ignored in ArgsTable #16811

Closed
MarcusNotheis opened this issue Nov 28, 2021 · 5 comments
Closed

Global argTypes table.category ignored in ArgsTable #16811

MarcusNotheis opened this issue Nov 28, 2021 · 5 comments

Comments

@MarcusNotheis
Copy link

Describe the bug
When setting a category as "global" arg types (in .storybook/preview.js), the section is not respected by the ArgTable anymore. This worked in 6.3.x.

// .storybook/preview.js
export const parameters = {
  // ...
  argTypes: {
    className: { table: { category: 'Styling' } },
  },
};

To Reproduce

  1. Checkout https://github.com/MarcusNotheis/sb-arg-types-repro
    (npx sb@next repro was throwing errors for me, I hope this repro is fine as well)
  2. Install dependencies and start the storybook using npm run storybook
  3. Open the Button Story in the Docs tab. You can see that the Styling category is missing:
    image
  4. Downgrade all storybook dependencies to 6.3.12, and restart the storybook. Now the styling section is available:
    image

System

Environment Info:

  System:
    OS: macOS 12.0.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 3.1.1 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.1.3 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 96.0.4664.55
    Edge: 96.0.1054.34
    Firefox: 94.0.1
    Safari: 15.1
  npmPackages:
    @storybook/addon-actions: ^6.4.0 => 6.4.0 
    @storybook/addon-docs: ^6.4.0 => 6.4.0 
    @storybook/addon-essentials: ^6.4.0 => 6.4.0 
    @storybook/addon-links: ^6.4.0 => 6.4.0 
    @storybook/node-logger: ^6.4.0 => 6.4.0 
    @storybook/preset-create-react-app: ^3.2.0 => 3.2.0 
    @storybook/react: ^6.4.0 => 6.4.0 
@shilman
Copy link
Member

shilman commented Nov 29, 2021

@MarcusNotheis this was never a supported API in 6.x, just an exploit of the internal implementation. here is the open feature request for the functionality you want #11697

cc @tmeasday

@shilman shilman closed this as completed Nov 29, 2021
@tmeasday
Copy link
Member

@MarcusNotheis try export argTypes = { ... };

@MarcusNotheis
Copy link
Author

Thanks @shilman and @tmeasday - using export const argTypes ... in preview.js did the trick :) Thanks for that hint!

@fehrm
Copy link

fehrm commented Dec 10, 2021

@tmeasday does this also work for Angular? I hit this warning and it doesn't seem to be working:

return logger.warn('Invalid args/argTypes in config, ignoring.', JSON.stringify(value));

@shilman
Copy link
Member

shilman commented Dec 11, 2021

@fehrm it looks like this is only supported when features.storyStoreV7 is true in .storybook/main.js:

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

No branches or pull requests

4 participants