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

Passing props into stories through decorators no longer working in Storybook 6.3 #15400

Closed
JoshTumath opened this issue Jun 28, 2021 · 6 comments

Comments

@JoshTumath
Copy link

Describe the bug
Prior to version 6.3 of Storybook, when I create a decorator, I'm able to pass props into it like so

export const withFoobar = (Story, context) => (
  <Story foobar="foo" {...context} />
);

And then I expect to be able to access the props from any story:

const Template = (args, { foobar }) => {
  return (
    <div>
      <Button {...args} />
      <p>
        This value should say 'foo': <code>{foobar}</code>
      </p>
    </div>
  );
};

However, as of 6.3, the props I pass in via the decorator are now undefined.

To Reproduce

https://github.com/JoshTumath/storybook-decorator-props-bug-repro

https://joshtumath.github.io/storybook-decorator-props-bug-repro/?path=/story/example-button--primary&globals=measureEnabled:false

System

Environment Info:

  System:
    OS: macOS 11.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 14.15.5 - ~/.nvm/versions/node/v14.15.5/bin/node
    Yarn: 2.4.2 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v14.15.5/bin/npm
  Browsers:
    Chrome: 91.0.4472.114
    Safari: 14.1.1
  npmPackages:
    @storybook/addon-actions: ^6.4.0-alpha.4 => 6.4.0-alpha.4 
    @storybook/addon-docs: ^6.4.0-alpha.4 => 6.4.0-alpha.4 
    @storybook/addon-essentials: ^6.4.0-alpha.4 => 6.4.0-alpha.4 
    @storybook/addon-links: ^6.4.0-alpha.4 => 6.4.0-alpha.4 
    @storybook/react: ^6.4.0-alpha.4 => 6.4.0-alpha.4

Additional context
None

@shilman
Copy link
Member

shilman commented Jun 28, 2021

Thanks @JoshTumath. I can confirm this is a regression from 6.2.9 which was introduced in 6.3.0-alpha.15, presumably in this PR: #14692

@tmeasday
Copy link
Member

👋 thanks for the repro @JoshTumath

@shilman
Copy link
Member

shilman commented Jun 29, 2021

Gadzooks!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.0-alpha.6 containing PR #15408 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Jun 29, 2021
@JoshTumath
Copy link
Author

Thank you for fixing! Does the 'patch' label on the PR mean the fix also be released in v6.3.2?

@shilman
Copy link
Member

shilman commented Jun 29, 2021

@JoshTumath Yes, will release in 6.3.x later this week or first thing next

@shilman
Copy link
Member

shilman commented Jun 30, 2021

Boo-yah!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.2 containing PR #15408 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade

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

3 participants