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

Preview story in docs doesn't work if story uses knobs #13

Open
justman00 opened this issue Feb 2, 2021 · 1 comment
Open

Preview story in docs doesn't work if story uses knobs #13

justman00 opened this issue Feb 2, 2021 · 1 comment

Comments

@justman00
Copy link

Describe the bug
When I try to use multiple Story components that are using knobs inside my docs file, only the default data of the knob from the first story is displaying

To Reproduce
I have put up a small reproducible example that you can find here: https://github.com/justman00/next-js-storybook-docs-knobs-issue.

Expected behavior
Expected behavior is that even if I have multiple stories with different knobs default value I should see the components accordingly in the docs as they are displayed in canvas:

export const firstStory = () => (
  <Demo content={text('content', 'This always shows')} />
);

export const secondStory = () => (
  <Demo content={text('content', 'this shows only in canvas')} />
);

export const thirdStory = () => (
  <Demo content={text('content', 'this shows also only in canvas')} />
);

From the code above in docs I should be able to see the same component with different content. However it is displayed with the value from the first story.

Here is the code from the docs:

<Preview withSource="none">
  <Story id="demo--first-story" />
</Preview>

<Preview withSource="none">
  <Story id="demo--second-story" />
</Preview>

<Preview withSource="none">
  <Story id="demo--third-story" />
</Preview>

Screenshots
Screen Shot 2021-02-02 at 17 15 37

Screen Shot 2021-02-02 at 17 15 25

@shilman
Copy link
Member

shilman commented Feb 17, 2021

FYI, we’ve released addon-controls in Storybook 6.0. Controls are portable, auto-generated knobs that are intended to replace addon-knobs, which are slated for deprecation.

Please upgrade and try out controls today!

@shilman shilman transferred this issue from storybookjs/storybook May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants