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:
parent
1148a0b637
commit
483306e73c
@ -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) {
|
if (selectionJSON !== lastSelection) {
|
||||||
lastSelection = selectionJSON;
|
lastSelection = selectionJSON;
|
||||||
RED.events.emit("view:selection-changed",selection);
|
RED.events.emit("view:selection-changed",selection);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user