Describe the bug
I know somebody would say that this is not an error,
but knobs 'number' dont work with default parameter values because
it returns null instead of undefined on empty string.
To Reproduce
Expected behavior
expect undefined, not null
Code snippets
storybook/addons/knobs/src/converters.js
Line 18:
toFloat: value => (value === '' ? null : parseFloat(value)),
Should be:
toFloat: value => (value === '' ? undefined : parseFloat(value)),
bs and good in general :)
I think this is a dupe to https://github.com/storybooks/storybook/issues/4487
Right @Hypnosphi ?
Looks like a completely different issue to me
I dont believe it's a duplicate of #4487 but clearly related.
The problem with 'select' knobs require another solution then this does.
The 'number' knobs is because it's has been choosen at some point to return 'null'
in storybook/addons/knobs/src/converters.js for numbers that a empty string instead of undefined
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!
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!
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!
I'm experiencing the same issue as well.
This is my workaround that worked for me:
export const knobsStory = () => (
<MyComponent myNum={number('My Number', 0.5) || undefined} />
);
Most helpful comment
I dont believe it's a duplicate of #4487 but clearly related.
The problem with 'select' knobs require another solution then this does.
The 'number' knobs is because it's has been choosen at some point to return 'null'
in
storybook/addons/knobs/src/converters.jsfor numbers that a empty string instead of undefined