Only delete node type from registry if id matches

If a node is moved out of node-red core to an npm installable
package, the first time NR runs after the move it correctly
deletes the node-red version from the registry. However it was
also removing the node constructors registered by the new
npm installed version as it wasn't checking what it was removing
came from the now-removed node.
pull/667/merge
Nick O'Leary 2015-06-08 16:32:50 +01:00
parent 369eae3d92
commit c5d8e09b41
1 changed files with 5 additions and 2 deletions

View File

@ -188,8 +188,11 @@ function removeNode(id) {
nodeList.splice(i,1);
}
config.types.forEach(function(t) {
delete nodeConstructors[t];
delete nodeTypeToId[t];
var typeId = nodeTypeToId[t];
if (typeId === id) {
delete nodeConstructors[t];
delete nodeTypeToId[t];
}
});
config.enabled = false;
config.loaded = false;