Controls incorrectly populating an undefined option
See original GitHub issueDescribe the bug
Since upgrading to v6.2.5 all optional component props using string literals are also outputting an “undefined” option. Whilst technically accurate, this is causing confusion with users, particularly where default prop values are set that would make an undefined value an impossible outcome.
Using TypeScript and React. We’ve upgraded directly from v6.1.2 so unclear exactly when the behaviour changed.
To Reproduce Steps to reproduce the behavior:
- Create a component using a string literal prop type
- View in Canvas and look in Controls panel
undefinedvalue should be present
Expected behavior
I’d expect undefined to be ignored even if it was technically present on the typing (due to being optional), as has historically been the case.
Screenshots
Incorrect in v6.2.5:

Expected behaviour as of v6.1.2:

System
System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
Binaries:
Node: 12.18.2 - C:\Program Files\nodejs\node.EXE
npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 89.0.4389.114
Edge: Spartan (44.19041.423.0), Chromium (89.0.774.68)
npmPackages:
@storybook/addon-a11y: ^6.2.5 => 6.2.5
@storybook/addon-actions: ^6.2.5 => 6.2.5
@storybook/addon-essentials: ^6.2.5 => 6.2.5
@storybook/addon-links: ^6.2.5 => 6.2.5
@storybook/node-logger: ^6.2.5 => 6.2.5
@storybook/preset-create-react-app: ^3.1.7 => 3.1.7
@storybook/react: ^6.2.5 => 6.2.5
@storybook/theming: ^6.2.5 => 6.2.5
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Populating select options Via ajax showing undefined -- Laravel
The options is populating with undefined and I'm not sure what i'm suppose to type to call the value correctly. The problem seems...
Read more >e.force:createRecord - Populating defaultFieldValues ...
The reason this occurs is down to the null or undefined value being passed to the lookup field. ... Looks like there's a...
Read more >7 Tips to Handle undefined in JavaScript - Dmitri Pavlutin
A detailed article about 'undefined' keyword in JavaScript. 7 tips on how to handle correctly 'undefined' and increase code durability.
Read more >Populating a dropdown with JQuery displays "undefined" result
Something is wrong but I don't know how to fix it. So please help me fix it. Here are the code. CONTROLLER (I...
Read more >Common Survey Errors - Qualtrics
The order of your questions is very important when setting up display logic. Display logic can only hide or reveal questions based on...
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

We are also explaining the same issue as the comments above
Storybook is passing
"undefined"(a string) instead ofundefinedto the component (this might be another bug next to the fact that undefined appears at all)Hi!
I don’t know if I need to open another issue but it seems to be on the same subject. I have this ‘undefined’ option too and if I use the value of the prop in a object, the actual value passed is ‘undefined’ (as string) which can crash storybook. You can see below the gif of the behavior and you can find the repository to reproduce the issue here
Despite that, storybook controls are amazing so thanks for them!