Skip to content

Commit abdf7a5

Browse files
committed
Fix unconnected nodes re-added to graph
1 parent 2f2dd4b commit abdf7a5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/lib/graph.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,12 @@ export const generateGraph = (data) => {
113113
for (const work of works) {
114114
if (typeof data.sets.refs[work] !== 'undefined') {
115115
for (const ref of data.sets.refs[work]) {
116-
graph.updateEdge(id, ref, attr => ({
117-
...attr,
118-
weight: (attr.weight || 0) + 1,
119-
}));
116+
if (graph.hasNode(ref)) {
117+
graph.updateEdge(id, ref, attr => ({
118+
...attr,
119+
weight: (attr.weight || 0) + 1,
120+
}));
121+
}
120122
}
121123
}
122124
}

0 commit comments

Comments
 (0)