Storybook controls shouldn't pass 'undefined' by default
See original GitHub issueNow that storybook doesn’t infer defaults for controls since 6.3+, there’s an unexpected behavior where stories will get undefined
explicitly as control values. This can mess up some components (in this case, React), because { someProp: undefined }
is different than {}
and it will result in strange behavior. For example, if you’re handling defaults by doing something like { ...DEFAULT_PROPS, props }
, then a value of undefined
will overwrite the default.
See discussion in issue #15378 for more details. Seems like this was introduced in #14579.
Mentioning people involved / with the same issue: tmeasday shilman penx mboettcher
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:14 (12 by maintainers)
Top Results From Across the Web
Args - Storybook - JS.ORG
Args specified through the URL will extend and override any default values of args set on the story. Mapping to complex arg values....
Read more >Storybook default selection control value - Stack Overflow
I need one of the options above to be selected by default. argTypes: { iconSrc: { options: Object.keys(iconTypes), mapping ...
Read more >A parameter to an Aura Action is undefined. But not always ...
I have a particularly strange issue where one, and only one parameter to an Aura Action is undefined. Worse, it seems to be...
Read more >Input Components - React-admin - Marmelab
Tip: By default, react-admin inputs have the following format function, which turns any null or undefined value into an empty string.
Read more >The geometry package - TeXDoc
to avoid an error with undefined control sequences. ... set the other margin with the margin ratio (1:1 by default for the vertical...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Crikey!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.5 containing PR #15654 that references this issue. Upgrade today to the
@latest
NPM tag to try it out!@pupudu I suppose the disabled case isn’t all that different as from the core’s perspective there should be no difference (disabling it just means show no UI to change/set it).