1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Avoid circular references when stingifying node objects

This commit is contained in:
Nick O'Leary 2017-05-19 20:35:36 +01:00
parent 1148a0b637
commit 483306e73c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -1165,7 +1165,14 @@ RED.view = (function() {
}
}
var selectionJSON = JSON.stringify(selection);
var selectionJSON = JSON.stringify(selection,function(key,value) {
if (key === 'nodes') {
return value.map(function(n) { return n.id })
} else if (key === 'link') {
return value.source.id+":"+value.sourcePort+":"+value.target.id;
}
return value;
});
if (selectionJSON !== lastSelection) {
lastSelection = selectionJSON;
RED.events.emit("view:selection-changed",selection);