From e5150ea012d442a73dafb6bc9b28669b86774876 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Tue, 31 Mar 2020 16:48:20 +0900 Subject: [PATCH 1/3] force redraw after node installation --- .../node_modules/@node-red/editor-client/src/js/nodes.js | 2 +- .../node_modules/@node-red/editor-client/src/js/ui/view.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/nodes.js b/packages/node_modules/@node-red/editor-client/src/js/nodes.js index cdf2c8796..ac5347961 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/nodes.js +++ b/packages/node_modules/@node-red/editor-client/src/js/nodes.js @@ -1499,7 +1499,7 @@ RED.nodes = (function() { l.target = newNodeMap[l.target.id]; } }); - RED.view.redraw(true); + RED.view.redraw(true, true); } }); }, diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index 44f75b481..5a7e11132 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -3765,7 +3765,12 @@ RED.view = (function() { } }, - redraw: function(updateActive) { + redraw: function(updateActive, force) { + if (force) { + activeNodes = []; + activeLinks = []; + redraw(); + } if (updateActive) { updateActiveNodes(); updateSelection(); From fa8236ee2cc34167945399dbe6bfbe6a9d5fb64f Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Tue, 31 Mar 2020 20:32:07 +0900 Subject: [PATCH 2/3] update for recent change of dev branch --- .../node_modules/@node-red/editor-client/src/js/ui/view.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index 7229680a5..da3f9b286 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -4565,7 +4565,8 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); } if (force) { activeNodes = []; activeLinks = []; - redraw(); + activeGroups = []; + _redraw(); } if (updateActive) { updateActiveNodes(); From 7fa4df082edd3411fbd27f1a2d17bd96a2e147ea Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 31 Mar 2020 15:58:51 +0100 Subject: [PATCH 3/3] Force sync redraw of view when replacing unknown nodes --- .../@node-red/editor-client/src/js/nodes.js | 7 ++++--- .../@node-red/editor-client/src/js/ui/view.js | 14 ++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/nodes.js b/packages/node_modules/@node-red/editor-client/src/js/nodes.js index 7150823c6..af60f6a30 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/nodes.js +++ b/packages/node_modules/@node-red/editor-client/src/js/nodes.js @@ -1596,8 +1596,9 @@ RED.nodes = (function() { }); removeLinks.forEach(removeLink); - - RED.view.redraw(true); + // Force the redraw to be synchronous so the view updates + // *now* and removes the unknown node + RED.view.redraw(true, true); var result = importNodes(reimportList,false); var newNodeMap = {}; result[0].forEach(function(n) { @@ -1611,7 +1612,7 @@ RED.nodes = (function() { l.target = newNodeMap[l.target.id]; } }); - RED.view.redraw(true, true); + RED.view.redraw(true); } }); }, diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index da3f9b286..aa2d14e44 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -4561,18 +4561,16 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); } }, updateActive: updateActiveNodes, - redraw: function(updateActive, force) { - if (force) { - activeNodes = []; - activeLinks = []; - activeGroups = []; - _redraw(); - } + redraw: function(updateActive, syncRedraw) { if (updateActive) { updateActiveNodes(); updateSelection(); } - redraw(); + if (syncRedraw) { + _redraw(); + } else { + redraw(); + } }, focus: focusView, importNodes: importNodes,