butterfly icon indicating copy to clipboard operation
butterfly copied to clipboard

Can't update canvas after updating in Vue

Open BlackFireAlex opened this issue 3 years ago • 5 comments

The current behavior

I currently have this callback in Vue component:

   changeForce() {
      console.log(this.canvas.layout.options.link.strength = this.forceValue)
      this.resetCanvas()
      
    }

and this function used to allow me update the graph

   resetCanvas() {
      this.key = ""
      this.data = {};
      this.$nextTick(() => {
        this.data = this.dataCopy
      })

    },

but it doesn't work anymore in "butterfly-dag": "^4.1.4" and "butterfly-vue": "1.0.4",

The expected behavior

I'm expecting to update the layout like before

Your environment(such as: Butterfly version、Browser version、OS and so on)

Butterfly version: "butterfly-dag": "^4.1.4" and "butterfly-vue": "1.0.4",

Browser version: Chrome lastest

OS: Windows 10

Steps To Reproduce, Maybe you can provide a simple demo.

BlackFireAlex avatar Aug 29 '21 12:08 BlackFireAlex

OK ,I know.I will reply to you or provide you with a solution after fix this.x

Zt448143356 avatar Aug 30 '21 02:08 Zt448143356

Okay thanks ! Would be great to have a fix even if it's not perfect.

BlackFireAlex avatar Aug 31 '21 20:08 BlackFireAlex

now,You can try this.in 1.0.4. image because: image watch is this, Modify canvasData directly, and this operation will not be monitored。 Modifying the array directly will not be monitored. This is a flaw in Vue's listening for array operations。

don't like this image

The array method overridden by Vue must be used to trigger the listening event。 image from:https://github.com/vuejs/vue/blob/dev/src/core/observer/array.js

Later TODO: Support :Direct modification canvasData image Should be supported in 1.0.5

Zt448143356 avatar Sep 01 '21 02:09 Zt448143356

I gt this error in the console unfortunately : vue.esm.js?a026:628 [Vue warn]: Error in callback for watcher "nodes": "Error: node not found: 0"

found in

vue.esm.js?a026:628 [Vue warn]: Error in callback for watcher "nodes": "Error: node not found: 0"

found in

---> <ButterflyVue>
       <App> at src/App.vue
         <Root>
.... Error: node not found: 0

BlackFireAlex avatar Sep 02 '21 17:09 BlackFireAlex

Can you provide the following demo or code to reproduce? This error does not appear when I use。

Zt448143356 avatar Sep 03 '21 01:09 Zt448143356