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

[Storybook 6.4] argTypeTargetsV7 breaks on stories without args #16743

Closed
yannbf opened this issue Nov 21, 2021 · 5 comments
Closed

[Storybook 6.4] argTypeTargetsV7 breaks on stories without args #16743

yannbf opened this issue Nov 21, 2021 · 5 comments

Comments

@yannbf
Copy link
Member

yannbf commented Nov 21, 2021

Describe the bug
image

To Reproduce
1 - Go to react-ts

2 - Enable argTypeTargetsV7:

  features: {
    argTypeTargetsV7: true,
  },

3 - Run react-ts storybook

3 - Go to http://localhost:9011/?path=/story/examples-emoji-button--basic

4 - Get the error. This is the story that causes the error:

export const Basic = () => <EmojiButton label="Click me" />;

It actually happens with any story that does not define args or argTypes, be it CSF1 2 or 3.

Things should break because context.args is undefined here:
https://github.com/storybookjs/storybook/blob/next/lib/store/src/prepareStory.ts#L169

@tmeasday
Copy link
Member

tmeasday commented Nov 22, 2021

🤔 hmm, why would context.args be undefined? I think it should always be defined... Will see if I can repro @yannbf

@tmeasday
Copy link
Member

@yannbf is there something different you are doing here? I am not seeing it:

export const CSF1 = (args, context) => console.log(args, context) || <div>Hello</div>

image

@yannbf
Copy link
Member Author

yannbf commented Nov 22, 2021

Hey @tmeasday I've got a simple way to reproduce it in the monorepo, I updated the steps in the issue description. Hope it helps!

@tmeasday
Copy link
Member

Ahh, got it, the component I was testing had some auto-generated argTypes 🤦

@shilman
Copy link
Member

shilman commented Nov 26, 2021

Jiminy cricket!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.0-rc.10 containing PR #16790 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 Nov 26, 2021
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