-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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.1.x change breaks Boolean knob #6366
Comments
Using the following instead addresses the known situations, however I haven't tested it against all knob types, and ideally there will be tests in any pull request for this fix. possible fix: |
I think I can fix this when in the upcoming weekend :) |
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! |
Use ES6 argument default value assignment to handle `undefined` case, which is never wanted; this prevent `false` cast to empty string (bug).
Sorry for this easy bug I committed to fix lately, I get many things pile up unfortunately 😂... I think this commit should logically fixing the bug since it allow |
…olean-knob BUGFIX v5.1.x change breaks Boolean knob (#6366)
Hey, thank you for pointing me a good direction to fix the bug, although I did not take you suggested bugfix approach. I would also encourage you to submit PR and invite people to review it next time :). The fact is The PR should be included in the next release, by then, feel free to file another issue if you have other concerns. 👍 |
@leoyli - No sweat from my end. If my pile hadn't been so high (and remained so high) I would have submitted a PR instead of a just a bug report. So at this point, I'm just happy you've submitted a fix! Thank you! 🙇♂️ |
Huzzah!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-rc.0 containing PR #6830 that references this issue. Upgrade today to try it out! Because it's a pre-release you can find it on the Closing this issue. Please re-open if you think there's still more to do. |
Describe the bug
Changing
value
tovalue: value || ''
in addons/knobs/src/components/PropForm.js (introduced with bug fix #6043 😞 ) causes boolean knobs to return an empty string when toggled fromtrue
, which itself causes the error:To Reproduce
Steps to reproduce the behavior:
node_modules/@storybook/addon-knobs/dist/components/PropForm.js
around line 76 changevalue: value || ''
to justvalue
(broken to fixed) or vice versa.yarn storybook
)Expected behavior
Toggling a boolean from
true
should not result in an error about an empty string.Screenshots
Bad ===
value: value || ''
Good ===
value
===value: value,
Code snippets
i.e. the opposite of bugfix #6043
Additional context
This boolean bug was introduced in a fix for changing a number value to an empty value (#6043). Fixes should account for both scenarios.
The text was updated successfully, but these errors were encountered: