Skip to content
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

vue knobs addon range component re-mounts the vue instance #2862

Closed
davidm-public opened this issue Jan 29, 2018 · 3 comments
Closed

vue knobs addon range component re-mounts the vue instance #2862

davidm-public opened this issue Jan 29, 2018 · 3 comments

Comments

@davidm-public
Copy link

Given this component:

<template>
  <div> ComponentA </div>
</template>

<script lang="ts">
  import Vue from 'vue'
  import { Component, Prop } from 'vue-property-decorator'

  @Component
  export default class ComponentA extends Vue{  
    @Prop({required:true}) val:number
    mounted(){
      console.log('mounted')
    }
  }
</script>

and a story:

 .addDecorator(withKnobs)
  .add('one', () =>{

     const val = number('val', 50, {
        range: true,
        min  : -50,
        max  : 50,
        step : 1,
     })
       
    return {
      template: `<component-a :val="${val}"></component-a>`
    }

The vue instance re-mounts (logs 'mounted') when this knob slider is moved.

Is it expected that moving the number() slider should re-mount the component?

I would have thought that just the property value should change??

@stale stale bot added the inactive label Mar 15, 2018
@Hypnosphi Hypnosphi added the vue label Mar 18, 2018
@stale stale bot removed the inactive label Mar 18, 2018
@stale stale bot added the inactive label Apr 8, 2018
@stale stale bot closed this as completed May 8, 2018
@davidqqq
Copy link

Hi I can confirm same thing happens when using button.

// "@storybook/addon-knobs": "^4.0.0-alpha.18",
import { button } from '@storybook/addon-knobs'
export default {
  template: '<div></div>',
  mounted () {
    console.log('mounted')
    button('click, this.click)
  },
  methods: {
    click () {
      console.log('clicked')
    }
  }
}

Each click re-mount and re-rendered the component. Any way to prevent re-mounting?

@OlegIvaniv
Copy link

Hi, any updates on this?

@storybookjs storybookjs deleted a comment from stale bot Nov 28, 2018
@storybookjs storybookjs deleted a comment from stale bot Nov 28, 2018
@storybookjs storybookjs deleted a comment from stale bot Nov 28, 2018
@igor-dv
Copy link
Member

igor-dv commented Dec 1, 2018

There were a few similar issues regarding this. You can take a look on an attempt to solve this in #4516

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants