alexcode / vue2vis

A Vuejs 2 adapter for Visjs
MIT License
217 stars 59 forks source link

Infinite update loop with hierarchical #53

Closed alucarddelta closed 4 years ago

alucarddelta commented 4 years ago

The console is reporting

You may have an infinite update loop in watcher with expression "options"

When using the following code.

<network class="network" ref="network" :nodes="this.vue2vis.nodes" :edges="this.vue2vis.edges" :options="options"

options: { layout: { hierarchical: { direction: "LR" } }, nodes: { shape: "square" }, }

When ever "hierarchical" is used even while empty, this message appears.

setaman commented 4 years ago

Have the same issue. I am injecting custom SVG and HTML to create nodes. So adding {layout: {hierarchical: ...}} breakes even custom nodes, nodes with default styles are displayed instead

setaman commented 4 years ago

you can walk around this issue by setting the hierarchical options manually like this:

mounted() {
    this.$refs.network.setOptions({
      layout: {
        hierarchical: {
         ...
        }
      },
    });
  }
alucarddelta commented 4 years ago

That worked like a treat!

I ended up moving all my options into that def and it works perfectly!

Thanks @setaman