1
0
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:
Nick O'Leary 2022-07-08 08:23:56 +01:00 committed by GitHub
commit 87258e485a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;