Skip to content

Commit 12fe34c

Browse files
authored
Sort node on serialization (#21)
1 parent 1fdf49f commit 12fe34c

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/litegraph.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,9 +2115,7 @@
21152115
*/
21162116
LGraph.prototype.serialize = function() {
21172117
var nodes_info = [];
2118-
for (var i = 0, l = this._nodes.length; i < l; ++i) {
2119-
nodes_info.push(this._nodes[i].serialize());
2120-
}
2118+
nodes_info = this._nodes.sort((a, b) => a.id - b.id).map(node => node.serialize());
21212119

21222120
//pack link info into a non-verbose format
21232121
var links = [];

0 commit comments

Comments
 (0)