Skip to content

[addon-knobs] Seeing knobs from previously selected story #19

@thany

Description

@thany

Describe the bug
When I select the first story after starting storybook, I see its knobs just fine. Then when I select another story, its knobs are added to the knobs that were there from the previously selected knobs.

Worse even, if the previously selected story had knobs in categories (tabs), the non-categorized knobs from the newly selected story are now tucked away in a "Other" tab.

To Reproduce
Upgrading/migrating from storybook 5.3 to 6.0, I suppose. That's the only thing that happened that made this break. I am already using the knobs preset in main.js, rather than its "register" notation in addons.js. And of course, everything is at the same 6.0.28 version.

Expected behavior
Knobs panel should only ever display knobs from the currently selected story.

Screenshots
image
1 - These are from the previously selected story and do not belong here. They never go away, even after having selected a docs-only story where the side panel goes away entirely.
2 - This is from the currently selected story, and should not be a tab. The currently selected does not have its knobs in categories, so I expect no tabs at all.

Code snippets
Relevant part of main.js:

module.exports = {
  stories: ['../../src/**/*.stories.@(jsx|mdx)'],
  addons: [
    '@storybook/addon-options',
    '@storybook/addon-knobs',
    '@storybook/addon-a11y',
    '@storybook/addon-docs',
  ]
};

Relevant part of manager.js:

import { addons } from '@storybook/addons';

// Option defaults:
addons.setConfig({
  name: 'Mijn Enexis',
  showNav: true,
  showPanel: true,
  panelPosition: 'right',
});

I don't know what else. There's no reference to knobs in preview.jsx, nor in theme.js.

System
Results of npx sb@next info:

  System:
    OS: Windows 10 10.0.19041
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
  Binaries:
    Node: 12.19.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 86.0.4240.183
    Edge: Spartan (44.19041.423.0)
  npmPackages:
    @storybook/addon-a11y: 6.0.28 => 6.0.28
    @storybook/addon-actions: 6.0.28 => 6.0.28
    @storybook/addon-docs: 6.0.28 => 6.0.28
    @storybook/addon-knobs: 6.0.28 => 6.0.28
    @storybook/react: 6.0.28 => 6.0.28
    @storybook/theming: 6.0.28 => 6.0.28

It doesn't see my actual browser, Firefox 82.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions