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

Ensure config nodes are deleted when owning subflow is deleted

This commit is contained in:
Nick O'Leary 2015-09-25 13:29:55 +01:00
parent b3602b268e
commit 719bb4263e

View File

@ -310,11 +310,18 @@ RED.subflow = (function() {
var removedLinks = []; var removedLinks = [];
var startDirty = RED.nodes.dirty(); var startDirty = RED.nodes.dirty();
var activeSubflow = getSubflow();
RED.nodes.eachNode(function(n) { RED.nodes.eachNode(function(n) {
if (n.type == "subflow:"+getSubflow().id) { if (n.type == "subflow:"+activeSubflow.id) {
removedNodes.push(n); removedNodes.push(n);
} }
if (n.z == getSubflow().id) { if (n.z == activeSubflow.id) {
removedNodes.push(n);
}
});
RED.nodes.eachConfig(function(n) {
if (n.z == activeSubflow.id) {
removedNodes.push(n); removedNodes.push(n);
} }
}); });
@ -328,8 +335,6 @@ RED.subflow = (function() {
// TODO: this whole delete logic should be in RED.nodes.removeSubflow.. // TODO: this whole delete logic should be in RED.nodes.removeSubflow..
removedNodes = removedNodes.concat(removedConfigNodes); removedNodes = removedNodes.concat(removedConfigNodes);
var activeSubflow = getSubflow();
RED.nodes.removeSubflow(activeSubflow); RED.nodes.removeSubflow(activeSubflow);
RED.history.push({ RED.history.push({