Comments (6)
I have the same problem. I have found that supplying a new key every time you update the data works. I update the graph like this:
let [graph, setGraph] = useState({ nodes: [], edges: [], rand: "" });
...
setGraph({
nodes: nodes,
edges: edges,
rand: Math.random().toString(),
});
And I use the Graph
element like this:
<Graph
key={graph.rand}
...
/>
Hope this helps until we can find a better solution.
from vis-react.
please share api_res
object
from vis-react.
I have same issue, I think.
Graph is in react state:
const [graph, setGraph] = useState({
nodes: [
{ id: 1, label: "Node 1" },
{ id: 2, label: "Node 2" },
{ id: 3, label: "Node 3" },
{ id: 4, label: "Node 4" },
{ id: 5, label: "Node 5" },
],
edges: [
{ from: 1, to: 2},
{ from: 1, to: 3 },
{ from: 2, to: 4 },
{ from: 2, to: 5 },
],
});
But when I call:
setGraph({
nodes: [...graph.nodes, { id: "6", label: 'Node 6' }],
edges: [...graph.edges],
});
I get the error Uncaught Error: Cannot add item: item with id 6 already exists
I guess this is the same error as #8: the add node function is being called twice for some reason, thus producing error
from vis-react.
Same issue here
from vis-react.
Same
from vis-react.
Hitting the same problem here. For some more diagnostic color, I randomly generated a string in render()
and prepend all node IDs with that string; this is calling twice in the same render cycle (i.e. the issue is not calling render
twice etc).
from vis-react.
Related Issues (19)
- Lack css in instructions HOT 1
- how can i use vis.js method
- Use visjs-network HOT 1
- Navigation buttons
- Fork/Relationship with react-graph-vis
- Fix ES Lint Unable to resolve path to module error HOT 1
- hoverEdge function not working HOT 3
- Changing `vis` dependency to exact commit rather than master
- Nodes with images fail to load after unmount and remount of Graph React component
- add getEdges HOT 2
- Getting errors in <Graph> component after updating to 0.5.1 HOT 2
- Unknown circles appear upon using <Graph> from `vis-react`
- Impossible to add legend
- How to get 100% height of canvas?
- Upgrade to support React 16 HOT 1
- setOptions HOT 5
- Add Item is being called twice for when reading nodes/ edges from redux and local storage HOT 1
- how to change tooltip content on node selection
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 vis-react.