Skip to content

Commit c6a40eb

Browse files
author
Alan Shaw
committed
fix: multi file edges
1 parent 87f0094 commit c6a40eb

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ const graphOpts = {
5757
const ipfs = new Ipfs()
5858
const { Buffer } = Ipfs
5959

60-
const addToVis = async (cy, cid, seen = []) => {
60+
const addToVis = async (cy, cid) => {
61+
if (cy.getElementById(cid.toString()).length) return
62+
6163
const { value: source } = await ipfs.dag.get(cid)
6264

6365
let nodeData = {}
@@ -74,16 +76,14 @@ const addToVis = async (cy, cid, seen = []) => {
7476
await addToVis(cy, source.links[i].cid)
7577
}
7678

77-
if (!cy.getElementById(cid.toString()).length) {
78-
cy.add({
79-
group: 'nodes',
80-
data: {
81-
id: cid.toString(),
82-
...nodeData
83-
},
84-
classes: source.links.length ? [] : ['leaf']
85-
})
86-
}
79+
cy.add({
80+
group: 'nodes',
81+
data: {
82+
id: cid.toString(),
83+
...nodeData
84+
},
85+
classes: source.links.length ? [] : ['leaf']
86+
})
8787

8888
cy.add(source.links.map(link => ({
8989
group: 'edges',

0 commit comments

Comments
 (0)