Skip to content

Commit 6f4b22d

Browse files
authoredMar 23, 2024··
fix(client): deduplicate node references in graph page #286 (#287)
1 parent a1aeddf commit 6f4b22d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed
 

‎packages/client/src/composables/graph.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,21 @@ export function parseGraphRawData(modules: ModuleInfo[], root: string) {
356356
}
357357

358358
const uniqueDeps = getUniqueDeps(mod.deps, (dep) => {
359+
node.edges.push(getEdge(mod.id, dep))
359360
// save references
360361
if (!moduleReferences.has(dep))
361362
moduleReferences.set(dep, [])
362-
moduleReferences.get(dep)!.push({
363+
const moduleReferencesValue = moduleReferences.get(dep)!
364+
const displayPath = removeRootPath(path)
365+
const isExist = !!(moduleReferencesValue.find(item => item.path === path && item.displayPath === displayPath && item.mod.id === mod.id))
366+
if (isExist)
367+
return
368+
369+
moduleReferencesValue.push({
363370
path,
364-
displayPath: removeRootPath(path),
371+
displayPath,
365372
mod,
366373
})
367-
node.edges.push(getEdge(mod.id, dep))
368374
})
369375
mod.deps = uniqueDeps
370376
graphNodesTotal.value.push(node)

0 commit comments

Comments
 (0)
Please sign in to comment.