Fix replacing an unknown node does not delete the node before reimporting it

This commit is contained in:
GogoVega 2024-06-20 19:02:14 +02:00
parent 6a2a763288
commit 34339615d9
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B

View File

@ -1895,7 +1895,7 @@ RED.nodes = (function() {
newNode.changed = true;
}
if (configNode.hasOwnProperty("d")) {
if (configNode.hasOwnProperty("d")) { // Disabled
newNode.d = configNode.d;
}
@ -1948,10 +1948,10 @@ RED.nodes = (function() {
newNode.outputLabels = node.outputLabels;
newNode.icon = node.icon;
}
if (node.hasOwnProperty("l")) {
if (node.hasOwnProperty("l")) { // Label (show/hide)
newNode.l = node.l;
}
if (node.hasOwnProperty("d")) {
if (node.hasOwnProperty("d")) { // Disabled
newNode.d = node.d;
}
if (node.hasOwnProperty("g")) { // Group
@ -3045,7 +3045,13 @@ RED.nodes = (function() {
removedNodes.push(convertNode(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
// the g property to be cleared. Cache it here so we can restore it.