node-red / node-red

Low-code programming for event-driven applications
http://nodered.org
Apache License 2.0
19.46k stars 3.37k forks source link

Using Shift to move wires between Link Nodes creates new Link #4839

Closed jnovah closed 3 weeks ago

jnovah commented 1 month ago

Current Behavior

When I select a single (or multiple; I haven't tried) wire between link nodes and use the SHIFT to move one end of the link node wire to another node, a new wire is created to that node.

Expected Behavior

I would expect that moving link node wires behaves the same as non-link node wires in that the old connection is replaced by the new.

Environment

dceejay commented 1 month ago

Can you share a small flow that demonstrates this ? I can't seem to replicate this from your description. Thanks

bonanitech commented 1 month ago

I was able to reproduce it using the flow below.

Steps to reproduce:

  1. Add a virtual link between 'link out 1' and 'link in 1'
  2. Hold the shift key and drag the connector from 'link in 1' to 'link in 2'

This results in 'link out 1' connected to both 'link in 1' and 'link in 2'.

The same happens if you drag the connector from 'link out 1' to 'link out 2'.

This was tested in 3.0.2, 3.1, and 4.0.

I also noticed that if you hit Deploy after Step 1, or Undo after Step 2, you can't drag that virtual link connector anymore.

[
    {
        "id": "3f96321c367fd06a",
        "type": "link in",
        "z": "7ec1f2d5af2030d3",
        "name": "link in 1",
        "links": [],
        "x": 785,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "d308c5279a5f240a",
        "type": "link out",
        "z": "7ec1f2d5af2030d3",
        "name": "link out 1",
        "mode": "link",
        "links": [],
        "x": 515,
        "y": 260,
        "wires": []
    },
    {
        "id": "9c22f7da64f9a13c",
        "type": "link in",
        "z": "7ec1f2d5af2030d3",
        "name": "link in 2",
        "links": [],
        "x": 785,
        "y": 340,
        "wires": [
            []
        ]
    },
    {
        "id": "46368469fd8111e6",
        "type": "link out",
        "z": "7ec1f2d5af2030d3",
        "name": "link out 2",
        "mode": "link",
        "links": [],
        "x": 515,
        "y": 340,
        "wires": []
    },
    {
        "id": "f6020da16fc2189d",
        "type": "link in",
        "z": "7ec1f2d5af2030d3",
        "name": "link in 3",
        "links": [],
        "x": 785,
        "y": 420,
        "wires": [
            []
        ]
    },
    {
        "id": "37fea3f35733b842",
        "type": "link out",
        "z": "7ec1f2d5af2030d3",
        "name": "link out 3",
        "mode": "link",
        "links": [],
        "x": 515,
        "y": 420,
        "wires": []
    }
]