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.

Knobs broken for Vue components

See original GitHub issue

Describe the bug The Knobs addon was working perfectly in v6 beta-21, but is no longer functioning correctly after upgrading to beta-25.

Using knobs on standard web elements works fine, but when passing as props to Vue components all values are being converted to strings and I receive the following error: Invalid prop: type check failed for prop "orange". Expected Boolean, got String with value "false".

I’ve also found that in some cases with components with only string props, no error is thrown but the default values within the component are used instead of the knobs and updating the knobs does not trigger any update (although knobs not used as props to Vue components continue to work).

I’ve tried both CSF and MDX story formats and both result in the same errors.

To Reproduce

Vue component

<template>
  <div :class="{ 'orange-spinner': orange }" />
</template>

<script>
import Vue from "vue";
export default Vue.extend({
  name: "TestSpinner",
  props: {
    orange: {
      type: Boolean,
      default: false,
    },
  },
});
</script>

Story

import { Story, Preview, Meta } from "@storybook/addon-docs/blocks";
import { withKnobs, boolean } from "@storybook/addon-knobs";
import TestSpinner from "./Spinner";

<Meta title="Components/Experimental/Spinner" component={TestSpinner} />

## Default

<Preview>
  <Story name="Base">
    {{
      components: { TestSpinner },
      props: {
        orange: {
          type: Boolean,
          default: boolean("Orange", false),
        },
      },
      template: `
    <TestSpinner :orange="orange" />
  `,
    }}
  </Story>
</Preview>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
piemasterscommented, Aug 9, 2020

Not sure if this issue still exists in the latest version of knobs, but I’ve fully transitioned over to controls and this is no longer an issue so happy for it to be closed.

0reactions
shilmancommented, Dec 20, 2020

@jowilhnson Yup. We have a few things to add to args/controls in 6.2 and then we’re going to deprecate knobs as part of the 6.2 milestone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue v-on:click does not work on component - Stack Overflow
I'm trying to use the on click directive inside a component but it does not seem to work. When ...
Read more >
Building "Renderless" Vue Components - CSS-Tricks
The term renderless components refers to components that don't render anything. In this article, we'll cover how Vue handles the rendering ...
Read more >
A light weight and intuitive knob component for Vue.js - Morioh
A simple, light weight and intuitive knob component for Vue.js.The vue-knob components attempts to simplify using knobs with your application by providing a ......
Read more >
@storybook/addon-knobs - npm
First of all, you need to install Knobs into your project as a dev dependency. yarn add @storybook/addon-knobs --dev. within .storybook/main.js ...
Read more >
Using SVG and Vue.js: A complete guide - LogRocket Blog
The title attribute handles that quite easily, thanks to a simple ternary. More great articles from LogRocket: Don't miss a moment with The ......
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