Skip to content

Commit 4b76cf6

Browse files
committed
Further tidy
1 parent 54f9e23 commit 4b76cf6

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/views/Graph.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -913,13 +913,13 @@ export default {
913913
914914
getGraphEdges () {
915915
// map graph edges from the store (non reactive)
916-
const ret = []
916+
const ret = new Map()
917917
for (const { $edges } of this.workflows) {
918918
for (const { tokens } of $edges || []) {
919-
ret.push([tokens.id, new Edge(tokens)])
919+
ret.set(tokens.id, new Edge(tokens))
920920
}
921921
}
922-
return new Map(ret)
922+
return ret
923923
},
924924
925925
/**
@@ -1172,11 +1172,15 @@ export default {
11721172
return ret.join('\n')
11731173
},
11741174
1175+
/**
1176+
* Generate a hash for this list of nodes and edges.
1177+
* @param {Node[]} nodes
1178+
* @param {Map<string, Edge>} edges
1179+
*/
11751180
hashGraph (nodes, edges) {
1176-
// generate a hash for this list of nodes and edges
11771181
return nonCryptoHash(
1178-
nodes.map(n => n.id).reduce((x, y) => x + y) +
1179-
Array.from(edges.keys()).reduce((x, y) => x + y, 1)
1182+
nodes.reduce((acc, n) => acc + n.id, '') +
1183+
Array.from(edges.keys()).reduce((acc, id) => acc + id, '')
11801184
)
11811185
},
11821186

0 commit comments

Comments
 (0)