Can't set callback arg to `null` on @storybook/react 6.3.0
See original GitHub issueDescribe 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: https://github.com/quangv/storybook_bug-null-callback/commit/4f5a1e898999158ff10221bb11dc2db525399145
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® Core™ 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
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
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!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.