Comments (4)
That has solved the issue!
Thank you for the fast help and the really useful library!
from v-network-graph.
Hi @dashavoo,
Thank you for your detailed report.
The minimal code to reproduce the problem you provided, helped me to quickly identify the issue point.
Thank you very much!
I've made a fix, please try a newer version. (v0.3.17).
from v-network-graph.
Thank you @dash14, you reacted really quickly to the bug report.
ForceLayout (with non-default settings) isn't working after the fix, but everything else works fine.
If you modify my previous example slightly to this:
<script setup lang="ts">
import { reactive, computed } from "vue"
import { ForceLayout } from "v-network-graph/lib/force-layout";
const whatsits = reactive([{id: "blah", name: "hi there"}])
const edges = reactive({});
const addNode = function () {
whatsits.push({id: "secondNode", name: "this works?"});
}
const configs = {
view: {
layoutHandler: new ForceLayout({
positionFixedByDrag: true,
positionFixedByClickWithAltKey: false,
// * The following are the default parameters for the simulation.
// * You can customize it by uncommenting below.
createSimulation: (d3, nodes, edges) => {
return d3.forceSimulation(nodes)
},
}),
},
}
const nodes = computed(() => Object.fromEntries(whatsits.map(e => [e.id, { name: e.name }])));
</script>
<template>
<button type="button" @click="addNode">Add node</button>
<ul>
<li v-for="n in whatsits" :key="n.id">{{ n.name }} is {{ nodes[n.id] ? "in" : "not in" }} "nodes"</li>
</ul>
<v-network-graph :nodes="nodes" :edges="edges" :configs="configs" />
</template>
and press the add button, you will see an error:
force.ts:119 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'links')
at watch.deep (force.ts:119:20)
at callWithErrorHandling (runtime-core.esm-bundler.js:155:22)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:164:21)
at Array.job (runtime-core.esm-bundler.js:1779:17)
at flushPreFlushCbs (runtime-core.esm-bundler.js:328:31)
at updateComponentPreRender (runtime-core.esm-bundler.js:5168:9)
at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5080:21)
at ReactiveEffect.run (reactivity.esm-bundler.js:160:29)
at updateComponent (runtime-core.esm-bundler.js:4968:26)
at processComponent (runtime-core.esm-bundler.js:4901:13)
However, if you comment out the customisation (lines 18, 19, 20) it works fine with the defaults.
from v-network-graph.
Hi @dashavoo,
Thank you for reporting the error.
Oops, the code inside the library assumed that force("edge", ...)
is specified....
I have fixed so that it will work without this configuration.
Please use the new version (v0.3.18).
from v-network-graph.
Related Issues (20)
- Performance improvement HOT 2
- Unexpected behavior for path containing repeated edge IDs HOT 3
- Potentially unnecessary rendering HOT 2
- Error with curved edges & force layout HOT 1
- Make the graph fit to the edges of the canvas? HOT 7
- Binding does not work in my code HOT 2
- Dynamic node list, d3force and stored positions HOT 4
- Chose from where the edge are starting/ending
- How to avoid edge labels overlapping/obstructed by other nodes/edges? HOT 1
- Performance Issues HOT 1
- Failed to resolve import "v-network-graph/lib/layouts/force" Does the file exist? HOT 2
- Change default selection keys
- Bug: path does not update for computed prop HOT 1
- Add touch events for mobile
- `tick` not rendering properly in `ForceLayout`
- Documentation: Layer example not working
- Node width HOT 1
- Is it possible to set different width for edges or paths between nodes? HOT 1
- Reactive defineConfigs? HOT 1
- Summarized edges markers behavior
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v-network-graph.