question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v5.1.x change breaks Boolean knob

See original GitHub issue

Describe 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:

  1. Go an existing project with a Boolean knob
  2. in node_modules/@storybook/addon-knobs/dist/components/PropForm.js around line 76 change value: value || '' to just value (broken to fixed) or vice versa.
  3. Restart the server (e.g. yarn storybook)
  4. 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 || ''

PropForm-Bad

Good === value === value: value,

PropForm-Good

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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
leoylicommented, Apr 23, 2019

I think I can fix this when in the upcoming weekend 😃

2reactions
metaseancommented, May 20, 2019

@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! 🙇‍♂️

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found