mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Merge pull request #3742 from Steve-Mcl/fix-tooltip-exception
prevent exception generating tooltip for deleted nodes
This commit is contained in:
		| @@ -3293,11 +3293,17 @@ RED.view = (function() { | ||||
|  | ||||
|         if (active && ((portType === PORT_TYPE_INPUT && ((d._def && d._def.inputLabels)||d.inputLabels)) || (portType === PORT_TYPE_OUTPUT && ((d._def && d._def.outputLabels)||d.outputLabels)))) { | ||||
|             portLabelHoverTimeout = setTimeout(function() { | ||||
|                 const n = port && port.node() | ||||
|                 const nId = n && n.__data__ && n.__data__.id | ||||
|                 //check see if node has been deleted since timeout started | ||||
|                 if(!n || !n.parentNode || !RED.nodes.node(n.__data__.id)) { | ||||
|                     return; //node is gone! | ||||
|                 } | ||||
|                 var tooltip = getPortLabel(d,portType,portIndex); | ||||
|                 if (!tooltip) { | ||||
|                     return; | ||||
|                 } | ||||
|                 var pos = getElementPosition(port.node()); | ||||
|                 var pos = getElementPosition(n); | ||||
|                 portLabelHoverTimeout = null; | ||||
|                 portLabelHover = showTooltip( | ||||
|                     (pos[0]+(portType===PORT_TYPE_INPUT?-2:12)), | ||||
| @@ -3734,6 +3740,10 @@ RED.view = (function() { | ||||
|             if (d.hasOwnProperty('l')?!d.l : (d.type === "link in" || d.type === "link out")) { | ||||
|                 var parentNode = this.parentNode; | ||||
|                 portLabelHoverTimeout = setTimeout(function() { | ||||
|                     //check see if node has been deleted since timeout started | ||||
|                     if(!parentNode || !parentNode.parentNode || !RED.nodes.node(parentNode.id)) { | ||||
|                         return; //node is gone! | ||||
|                     } | ||||
|                     var tooltip; | ||||
|                     if (d._def.label) { | ||||
|                         tooltip = d._def.label; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user