mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix replacing an unknown node does not delete the node before reimporting it
This commit is contained in:
parent
6a2a763288
commit
34339615d9
@ -1895,7 +1895,7 @@ RED.nodes = (function() {
|
|||||||
newNode.changed = true;
|
newNode.changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configNode.hasOwnProperty("d")) {
|
if (configNode.hasOwnProperty("d")) { // Disabled
|
||||||
newNode.d = configNode.d;
|
newNode.d = configNode.d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1948,10 +1948,10 @@ RED.nodes = (function() {
|
|||||||
newNode.outputLabels = node.outputLabels;
|
newNode.outputLabels = node.outputLabels;
|
||||||
newNode.icon = node.icon;
|
newNode.icon = node.icon;
|
||||||
}
|
}
|
||||||
if (node.hasOwnProperty("l")) {
|
if (node.hasOwnProperty("l")) { // Label (show/hide)
|
||||||
newNode.l = node.l;
|
newNode.l = node.l;
|
||||||
}
|
}
|
||||||
if (node.hasOwnProperty("d")) {
|
if (node.hasOwnProperty("d")) { // Disabled
|
||||||
newNode.d = node.d;
|
newNode.d = node.d;
|
||||||
}
|
}
|
||||||
if (node.hasOwnProperty("g")) { // Group
|
if (node.hasOwnProperty("g")) { // Group
|
||||||
@ -3045,7 +3045,13 @@ RED.nodes = (function() {
|
|||||||
removedNodes.push(convertNode(node));
|
removedNodes.push(convertNode(node));
|
||||||
|
|
||||||
// Remove the Node
|
// Remove the Node
|
||||||
removeNode(node);
|
// NOTE: DON'T use removeNode - no need for everything that is done there.
|
||||||
|
// Just delete the node because we re-import it as is afterwards.
|
||||||
|
if (configNodes.hasOwnProperty(node.id)) {
|
||||||
|
delete configNodes[node.id];
|
||||||
|
} else {
|
||||||
|
allNodes.removeNode(node);
|
||||||
|
}
|
||||||
|
|
||||||
// Reimporting a node *without* including its group object will cause
|
// Reimporting a node *without* including its group object will cause
|
||||||
// the g property to be cleared. Cache it here so we can restore it.
|
// the g property to be cleared. Cache it here so we can restore it.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user