From 6dd38c3c16f25e590563595a94ae95e5c193a33d Mon Sep 17 00:00:00 2001 From: marcsello Date: Fri, 4 Dec 2020 22:55:33 +0100 Subject: [PATCH] Fixed adding to an empty workspace --- src/views/Dashboard.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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)