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.

Controls incorrectly populating an undefined option

See original GitHub issue

Describe 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:

  1. Create a component using a string literal prop type
  2. View in Canvas and look in Controls panel
  3. undefined value 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: image

Expected behaviour as of v6.1.2: image

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:open
  • Created 2 years ago
  • Reactions:4
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
Yonomcommented, May 27, 2021

We are also explaining the same issue as the comments above

Storybook is passing "undefined" (a string) instead of undefined to the component (this might be another bug next to the fact that undefined appears at all)

6reactions
vinassefranchecommented, May 3, 2021

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

storybook-issue

Despite that, storybook controls are amazing so thanks for them!

Read more comments on GitHub >

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

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