mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3742 from Steve-Mcl/fix-tooltip-exception
prevent exception generating tooltip for deleted nodes
This commit is contained in:
commit
87258e485a
@ -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)))) {
|
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() {
|
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);
|
var tooltip = getPortLabel(d,portType,portIndex);
|
||||||
if (!tooltip) {
|
if (!tooltip) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var pos = getElementPosition(port.node());
|
var pos = getElementPosition(n);
|
||||||
portLabelHoverTimeout = null;
|
portLabelHoverTimeout = null;
|
||||||
portLabelHover = showTooltip(
|
portLabelHover = showTooltip(
|
||||||
(pos[0]+(portType===PORT_TYPE_INPUT?-2:12)),
|
(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")) {
|
if (d.hasOwnProperty('l')?!d.l : (d.type === "link in" || d.type === "link out")) {
|
||||||
var parentNode = this.parentNode;
|
var parentNode = this.parentNode;
|
||||||
portLabelHoverTimeout = setTimeout(function() {
|
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;
|
var tooltip;
|
||||||
if (d._def.label) {
|
if (d._def.label) {
|
||||||
tooltip = d._def.label;
|
tooltip = d._def.label;
|
||||||
|
Loading…
Reference in New Issue
Block a user