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

Can't set callback arg to null on @storybook/react 6.3.0 #15370

Closed
quangv opened this issue Jun 25, 2021 · 6 comments
Closed

Can't set callback arg to null on @storybook/react 6.3.0 #15370

quangv opened this issue Jun 25, 2021 · 6 comments

Comments

@quangv
Copy link

quangv commented Jun 25, 2021

Describe the bug
As of @storybook/react 6.3.0 can't seem to set a callback arg to null, the argTypesRegex seems to over zealously create an actionHandler when manually setting an arg callback to null. This wasn't happening with @storybook/react 6.2.9

To Reproduce
Please create a reproduction by running npx sb@next repro and following the instructions. Read our documentation to learn more about creating reproductions.
Paste your repository and deployed reproduction here. We prioritize issues with reproductions over those without.

https://github.com/quangv/storybook_bug-null-callback

specifically: quangv/storybook_bug-null-callback@4f5a1e8

export const Primary = Template.bind({});
Primary.args = {
  primary: true,
  label: 'Button',
  onClick: null // can't seem to set this to null
};

Only way I can figure out how to keep it null is tweaking the argsTypesRegex

parameters: { actions: { argTypesRegex: '^on(?!Click).*' } }

System

`ᐅ npx sb@next info

Environment Info:

System:
OS: macOS 11.4
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Binaries:
Node: 12.22.1 - ~/.nvm/versions/node/v12.22.1/bin/node
Yarn: 2.4.2 - ~/.nvm/versions/node/v12.22.1/bin/yarn
npm: 6.14.13 - ~/.nvm/versions/node/v12.22.1/bin/npm
Browsers:
Chrome: 91.0.4472.114
Safari: 14.1.1
npmPackages:
@storybook/addon-actions: ^6.4.0-alpha.2 => 6.4.0-alpha.2
@storybook/addon-docs: ^6.4.0-alpha.2 => 6.4.0-alpha.2
@storybook/addon-essentials: ^6.4.0-alpha.2 => 6.4.0-alpha.2
@storybook/addon-links: ^6.4.0-alpha.2 => 6.4.0-alpha.2
@storybook/react: ^6.4.0-alpha.2 => 6.4.0-alpha.2`

Additional context
n/a

@quangv quangv changed the title Can't set callback arg to null Can't set callback arg to null on 6.3.0 Jun 25, 2021
@quangv quangv changed the title Can't set callback arg to null on 6.3.0 Can't set callback arg to null on @storybook/react 6.3.0 Jun 25, 2021
@quangv
Copy link
Author

quangv commented Jun 25, 2021

I noticed it doesn't have to do with null, but the arg.onHandler gets overwritten regardless of the value... is this suppose to happen now as of v6.3.0 ?

I do see we can still access it via the new originalStoryFn.args ...

@shilman
Copy link
Member

shilman commented Jun 28, 2021

Jeepers creepers!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.0-alpha.4 containing PR #15394 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 28, 2021
@shilman
Copy link
Member

shilman commented Jun 28, 2021

Jiminy cricket!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.1 containing PR #15394 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade

@brandonthomas
Copy link

@shilman I'm still seeing this in 6.5.9.

@shilman
Copy link
Member

shilman commented Sep 7, 2022

@brandonthomas can you please share a reproduction? i just tried it in the original repro & it demonstrates the bug, but upgraded to 6.5 and the bug is fixed (for that example, at least)

@brandonthomas
Copy link

@brandonthomas can you please share a reproduction? i just tried it in the original repro & it demonstrates the bug, but upgraded to 6.5 and the bug is fixed (for that example, at least)

Just did more digging and looks like we had an erroneous argTypesRegex so I think we're good now. It was pulling in a bunch of on* render functions. Removal of argTypesRegex fixed the issue.

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