diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 4c1d51b..a8703f5 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -103,9 +103,13 @@ export default { break; } - const max_id = maxBy(this.diagram.nodes, 'id').id + if (this.diagram.nodes.length > 0) { + const max_id = maxBy(this.diagram.nodes, 'id').id - newNode.id = max_id + 1; + newNode.id = max_id + 1; + } else { + newNode.id = 0; + } this.diagram.nodes.push(newNode)