addon-jsx icon indicating copy to clipboard operation
addon-jsx copied to clipboard

[Bug] JSX tab remains visible when addon is disabled

Open TrevorBurnham opened this issue 4 years ago • 1 comments

Describe the bug

When this addon is disabled for a story, the "JSX" tab is still shown in the addons panel, but with blank contents.

Steps to reproduce the behavior

  1. Clone this repo: https://github.com/TrevorBurnham/storybook-addon-jsx-disable-noop
  2. Run yarn && yarn storybook
  3. Visit http://localhost:6006/?path=/story/example-button--primary
  4. Open the addons panel

Notice that the JSX tab is visible but blank because of this code:

Primary.parameters = {
  jsx: {
    disable: true,
  },
};

Expected behavior

The JSX tab should not be shown in the addons panel when the addon is disabled. This is the behavior for other addons; for example, this code hides the Actions tab for the story:

Primary.parameters = {
  actions: {
    disable: true,
  },
};

Screenshots and/or logs

When not disabled

JSX addon tab has contents

When disabled

JSX addon tab is empty

Environment

  • OS: macOS 11.5.2
  • Node.js version: 15.10.0
  • NPM version: Yarn 3.0.1
  • Browser (if applicable): Chrome
  • Browser version (if applicable): 92

Additional context

The repro project uses @storybook/[email protected]. The project where I first observed this issue was on @storybook/[email protected].

I'm not sure what the problem here is, since the way the addon uses makeDecorator (#110) looks perfectly normal to me. Maybe something about that API has changed in more recent versions of Storybook? cc @petermikitsh @hipstersmoothie

TrevorBurnham avatar Aug 29 '21 19:08 TrevorBurnham

I just ran into this as well, I believe it's because paramKey is not specified here. This is what's required according to storybook docs

drewbrend avatar Feb 04 '22 19:02 drewbrend