From c5d8e09b41d10caa544e3934c8b0acc07901e052 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 8 Jun 2015 16:32:50 +0100 Subject: [PATCH] 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. --- red/nodes/registry/registry.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/red/nodes/registry/registry.js b/red/nodes/registry/registry.js index fe630d4ca..3343eb2e7 100644 --- a/red/nodes/registry/registry.js +++ b/red/nodes/registry/registry.js @@ -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;