question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storybook controls shouldn't pass 'undefined' by default

See original GitHub issue

Now 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:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

6reactions
shilmancommented, Jul 22, 2021

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!

npx sb upgrade
1reaction
tmeasdaycommented, Jul 22, 2021

@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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found