mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Fix adding links to missing nodes inside a subflow
This commit is contained in:
		@@ -1386,7 +1386,7 @@ RED.nodes = (function() {
 | 
			
		||||
            var wires = links.filter(function(d) { return d.source === p });
 | 
			
		||||
            for (var i=0;i<wires.length;i++) {
 | 
			
		||||
                var w = wires[i];
 | 
			
		||||
                if (w?.target && w.target.type != "subflow") {
 | 
			
		||||
                if (w.target.type != "subflow") {
 | 
			
		||||
                    nIn.wires.push({id:w.target.id})
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -2422,12 +2422,13 @@ RED.nodes = (function() {
 | 
			
		||||
 | 
			
		||||
        // Add Links to Workspace
 | 
			
		||||
        for (const subflow of newSubflows) {
 | 
			
		||||
            // TODO: Handled missing node
 | 
			
		||||
            subflow.in.forEach(function (input) {
 | 
			
		||||
                input.wires.forEach(function (wire) {
 | 
			
		||||
                    const link = { source: input, sourcePort: 0, target: nodeMap[wire.id] };
 | 
			
		||||
                    addLink(link);
 | 
			
		||||
                    newLinks.push(link);
 | 
			
		||||
                    if (nodeMap.hasOwnProperty(wire.id)) {
 | 
			
		||||
                        const link = { source: input, sourcePort: 0, target: nodeMap[wire.id] };
 | 
			
		||||
                        addLink(link);
 | 
			
		||||
                        newLinks.push(link);
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
                delete input.wires;
 | 
			
		||||
            });
 | 
			
		||||
@@ -2437,11 +2438,14 @@ RED.nodes = (function() {
 | 
			
		||||
                    let link;
 | 
			
		||||
                    if (subflowMap[wire.id] && subflowMap[wire.id].id === subflow.id) {
 | 
			
		||||
                        link = { source: subflow.in[wire.port], sourcePort: wire.port, target: output };
 | 
			
		||||
                    } else {
 | 
			
		||||
                    } else if (nodeMap.hasOwnProperty(wire.id) || subflowMap.hasOwnProperty(wire.id)) {
 | 
			
		||||
                        link = { source: nodeMap[wire.id] || subflowMap[wire.id], sourcePort: wire.port, target: output };
 | 
			
		||||
                    }
 | 
			
		||||
                    addLink(link);
 | 
			
		||||
                    newLinks.push(link);
 | 
			
		||||
 | 
			
		||||
                    if (link) {
 | 
			
		||||
                        addLink(link);
 | 
			
		||||
                        newLinks.push(link);
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
                delete output.wires;
 | 
			
		||||
            });
 | 
			
		||||
@@ -2450,11 +2454,14 @@ RED.nodes = (function() {
 | 
			
		||||
                let link;
 | 
			
		||||
                if (subflowMap[wire.id] && subflowMap[wire.id].id === subflow.id) {
 | 
			
		||||
                    link = { source: subflow.in[wire.port], sourcePort: wire.port, target: subflow.status };
 | 
			
		||||
                } else {
 | 
			
		||||
                    link = { source: subflowMap[wire.id] || subflowMap[wire.id], sourcePort: wire.port, target: subflow.status };
 | 
			
		||||
                } else if (nodeMap.hasOwnProperty(wire.id) || subflowMap.hasOwnProperty(wire.id)) {
 | 
			
		||||
                    link = { source: nodeMap[wire.id] || subflowMap[wire.id], sourcePort: wire.port, target: subflow.status };
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (link) {
 | 
			
		||||
                    addLink(link);
 | 
			
		||||
                    newLinks.push(link);
 | 
			
		||||
                }
 | 
			
		||||
                addLink(link);
 | 
			
		||||
                newLinks.push(link);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            if (subflow.status) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user