v5.1.x change breaks Boolean knob
See original GitHub issueDescribe the bug
Changing value
to value: value || ''
in addons/knobs/src/components/PropForm.js (introduced with bug fix #6043 😞 ) causes boolean knobs to return an empty string when toggled from true
, which itself causes the error:
Warning: Failed prop type: Invalid prop `knob.value` of type `string` supplied to `BooleanType`, expected `boolean`.
To Reproduce Steps to reproduce the behavior:
- Go an existing project with a Boolean knob
- in
node_modules/@storybook/addon-knobs/dist/components/PropForm.js
around line 76 changevalue: value || ''
to justvalue
(broken to fixed) or vice versa. - Restart the server (e.g.
yarn storybook
) - With console log open, toggle a boolean knob
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
_createClass(PropForm, [{
key: "makeChangeHandler",
value: function makeChangeHandler(name, type) {
var onFieldChange = this.props.onFieldChange;
return function (value) {
var change = {
name: name,
type: type,
// value, // <-- GOOD in v5.0.6
value: value || '', // <-- BROKEN in v5.1.x
};
onFieldChange(change);
};
}
}, {
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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
WHY your BOOLEANS do not work in Blender? - YouTube
In this video I will show you how to solve common issues with boolean workflow for hard surface in Blender. I am using...
Read more >Introduction to C / C++ Programming Decision and Branching ...
C does not have boolean data types, and normally uses integers for boolean testing. ... Example: To determine whether x is between 5.0...
Read more >Upgrading from 5.x - React Navigation
This is probably one of the biggest changes. When navigating to an existing screen, we've merged the new params with the existing params...
Read more >Unreal Engine 5.1 Release Notes
Whenever you need to make a change to one of these variables, you update it within the Viewmodel rather than directly in your...
Read more >Changes — Click Documentation (8.1.x)
Drop support for Python 3.6. · Rely on PEP 538 and PEP 540 to handle selecting UTF-8 encoding instead of ASCII. · Single...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I can fix this when in the upcoming weekend 😃
@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! 🙇♂️