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

Addons / Knobs - When type is Number using the number knob, throws an error on delete and field is null #9472

Closed
poblouin opened this issue Jan 15, 2020 · 7 comments

Comments

@poblouin
Copy link

poblouin commented Jan 15, 2020

Describe the bug
You have a knob, the prop type is Number and the default is number('something', 0). If the user deletes the 0 (or all digits in the field), an error is thrown in the console because the value cannot be null

vendors~main.5317d89c4b17337a8714.bundle.js:103113 Warning: `value` prop on `input` should not be null. Consider using an empty string to clear the component or `undefined` for uncontrolled components.

To Reproduce
Steps to reproduce the behavior:

  1. Set a prop using a knob in a story
      hello: {
        type: Number,
        default: number('hello', 0),
      },
  1. Use it in the template
  2. Run the Storybook
  3. Navigate to the story, delete the value in that knob field
  4. See error in console

Expected behavior
Either accept null (since it's a valid value for Number) or on delete set back the default value or 0. I dunno whatever makes sense to you.

System:

Environment Info:

  System:
    OS: macOS 10.15.2
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 10.5.0 - ~/.nvm/versions/node/v10.5.0/bin/node
    npm: 6.1.0 - ~/.nvm/versions/node/v10.5.0/bin/npm
  Browsers:
    Chrome: 79.0.3945.117
    Firefox: 71.0
    Safari: 13.0.4
  npmPackages:
    @storybook/addon-a11y: ^5.0.3 => 5.1.9
    @storybook/addon-cssresources: ^5.0.11 => 5.1.9
    @storybook/addon-knobs: ^5.1.8 => 5.1.9
    @storybook/addon-notes: ^5.1.8 => 5.1.9
    @storybook/addon-viewport: ^5.1.8 => 5.1.9
    @storybook/theming: ^5.1.8 => 5.1.9
    @storybook/vue: ^5.2.8 => 5.2.8

Extra
Right now to bypass that limitation, I use a String that I parse as a Number in the template..

@poblouin
Copy link
Author

Let me know if you guys if you need more info

@stale
Copy link

stale bot commented Feb 11, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Feb 11, 2020
@poblouin
Copy link
Author

I didn't have the time to investigate more, but this is still a problem in latest version.

@stale stale bot removed the inactive label Feb 11, 2020
@stale
Copy link

stale bot commented Mar 3, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Mar 3, 2020
@poblouin
Copy link
Author

poblouin commented Mar 3, 2020

still an issue

@stale stale bot removed the inactive label Mar 3, 2020
@stale
Copy link

stale bot commented Mar 24, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Mar 24, 2020
@stale
Copy link

stale bot commented Apr 25, 2020

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

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