diff --git a/src/litegraph.js b/src/litegraph.js index d75a6737d..e23c826e8 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -689,7 +689,9 @@ LGraph.prototype.add = function(node, skip_compute_order) //give him an id if(node.id == null || node.id == -1) - node.id = this.last_node_id++; + node.id = ++this.last_node_id; + else if (this.last_node_id < node.id) + this.last_node_id = node.id; node.graph = this;