1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix removing links when deleting node

This commit is contained in:
Nick O'Leary 2021-02-27 21:57:27 +00:00
parent fc709ba266
commit 7be7dec19a
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -31,7 +31,7 @@ RED.nodes = (function() {
var groups = {}; var groups = {};
var groupsByZ = {}; var groupsByZ = {};
RED.nl = nodeLinks;
var initialLoad; var initialLoad;
var dirty = false; var dirty = false;
@ -429,13 +429,13 @@ RED.nodes = (function() {
var index = links.indexOf(l); var index = links.indexOf(l);
if (index != -1) { if (index != -1) {
links.splice(index,1); links.splice(index,1);
if (l.source) { if (l.source && nodeLinks[l.source.id]) {
var sIndex = nodeLinks[l.source.id].out.indexOf(l) var sIndex = nodeLinks[l.source.id].out.indexOf(l)
if (sIndex !== -1) { if (sIndex !== -1) {
nodeLinks[l.source.id].out.splice(sIndex,1) nodeLinks[l.source.id].out.splice(sIndex,1)
} }
} }
if (l.target) { if (l.target && nodeLinks[l.target.id]) {
var tIndex = nodeLinks[l.target.id].in.indexOf(l) var tIndex = nodeLinks[l.target.id].in.indexOf(l)
if (tIndex !== -1) { if (tIndex !== -1) {
nodeLinks[l.target.id].in.splice(tIndex,1) nodeLinks[l.target.id].in.splice(tIndex,1)