mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Delay when nodes are added to internal model on import
Closes #2567 This ensures when the node:added event fires, all possible changes have already been applied such as remapping node ids. This avoids the need to emit a separate node:changed event.
This commit is contained in:
parent
1f2c0a78c2
commit
fe1f8ca0a8
@ -1124,7 +1124,6 @@ RED.nodes = (function() {
|
||||
}
|
||||
node_map[n.id] = configNode;
|
||||
new_nodes.push(configNode);
|
||||
RED.nodes.add(configNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1296,12 +1295,6 @@ RED.nodes = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.type !== "group") {
|
||||
addNode(node);
|
||||
RED.editor.validateNode(node);
|
||||
} else {
|
||||
addGroup(node);
|
||||
}
|
||||
node_map[n.id] = node;
|
||||
// If an 'unknown' config node, it will not have been caught by the
|
||||
// proper config node handling, so needs adding to new_nodes here
|
||||
@ -1426,6 +1419,13 @@ RED.nodes = (function() {
|
||||
n.nodes = n.nodes.map(function(id) {
|
||||
return node_map[id];
|
||||
})
|
||||
addGroup(n);
|
||||
}
|
||||
// Now the nodes have been fully updated, add them.
|
||||
for (i=0;i<new_nodes.length;i++) {
|
||||
node = new_nodes[i];
|
||||
addNode(node);
|
||||
RED.editor.validateNode(node);
|
||||
}
|
||||
|
||||
RED.workspaces.refresh();
|
||||
|
Loading…
Reference in New Issue
Block a user