Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.3.1 knobs: runtime exception on null value in select array #9405

Closed
johnhunter opened this issue Jan 13, 2020 · 3 comments
Closed

v5.3.1 knobs: runtime exception on null value in select array #9405

johnhunter opened this issue Jan 13, 2020 · 3 comments

Comments

@johnhunter
Copy link
Contributor

johnhunter commented Jan 13, 2020

Describe the bug
Updating addon-knobs to 5.3.1 throws a TypeError when a select knob array argument contains a null.

To Reproduce
Steps to reproduce the behavior:

  1. Create a story as per the snippet below
  2. npm run storybook
  3. Navigate to the "null" story
  4. See exception thrown in console Uncaught TypeError: Cannot read property 'label' of null

Expected behavior
Story should display with the following select options for 'value':
1, 2, 3, _undefined_, null

Code snippets

stories.add(
  'null',
  () => {
    const value = select('value', [1, 2, 3, undefined, null], 1);
    return <div>{value}</div>;
  }
);

System:

  System:
    OS: macOS 10.15.2
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 12.12.0 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.13.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 79.0.3945.117
    Firefox: 72.0.1
    Safari: 13.0.4
  npmPackages:
    @storybook/addon-actions: ^5.3.1 => 5.3.1 
    @storybook/addon-backgrounds: ^5.3.1 => 5.3.1 
    @storybook/addon-console: ^1.2.1 => 1.2.1 
    @storybook/addon-info: ^5.3.1 => 5.3.1 
    @storybook/addon-knobs: ^5.3.1 => 5.3.1 
    @storybook/addon-links: ^5.3.1 => 5.3.1 
    @storybook/addon-notes: ^5.3.1 => 5.3.1 
    @storybook/addon-options: ^5.3.1 => 5.3.1 
    @storybook/addon-viewport: ^5.3.1 => 5.3.1 
    @storybook/addons: ^5.3.1 => 5.3.1 
    @storybook/cli: ^5.3.1 => 5.3.1 
    @storybook/react: ^5.3.1 => 5.3.1 
@johnhunter
Copy link
Contributor Author

Thanks guys!

@shilman
Copy link
Member

shilman commented Jan 14, 2020

Ta-da!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.3 containing PR #9416 that references this issue. Upgrade today to try it out!

@johnhunter
Copy link
Contributor Author

Less than 24h turnaround - fantastic!! 🙌

@shilman shilman added this to the 5.3.x milestone Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants