Selfconnectedness or how to connect a node to itself

Hi There,

I just noticed that nodes cannot be connected to themselves - probably very sensible.

However if I delete a connected node using the "maintain connections" (ctrl/cmd-delete/backspace) functionality, I can get a node to be connected to itself.

selfconnectedness

When I export the node, the wire is included in the export, i.e., maintained.

Ironically I'm just making use of that feature! :slight_smile:

(Tested with 4.0.5 & 3.1.9)

Thanks for highlighting this bug. I'll be sure it gets fixed in the next maintenance release.

https://github.com/node-red/node-red/issues/5038

1 Like

Are you certain that it should not be possible to wire a node to itself? I have wanted to do this occasionally myself and have had to insert a junction to do it, which ends up with a messy looking flow.

I've tended to use a second function node because I did something there but using an junction node is far better - but not as good as the self loop function node (IMHO):

We chose to not allow self-loops as it was too easy to create infinite loops by mistake.

Requiring a second node, or junction, adds a little bit of friction and makes it a more intentional choice.

1 Like

Ah! But then adding the second node and deleting it with a maintain-connection (i.e. how to create the self loop now) is also friction, so leaving it as is would allow @Colin and I to create our self reference loops and everyone else to wonder how we created them! :wink:

1 Like

Having to add a second node and then to delete it using ctrl delete, adds a bit of friction to. I use the feature/bug as you call it in some flows. To fix this would cause breaking changes. I for one vote to keep this feature.

I don't because I never thought about it - I also thought/assumed that self-connecting nodes wasn't a use-case for the day-2-day. But having discovered it, I would also definitely use it in the future. So I would also vote for not touching a running system.

Any fix would be to stop the Cmd/Ctrl-Delete action from leaving a node wired to itself. Any nodes already wired to themselves would be untouched - nothing would break other than the ability to create new such cases.

It isn't really a burning issue... I've raised it, may just let it be as it is for now.

IF you did remove it, I suppose i could just manually change the wire array element to self loop any way. So in any case I could still self loop if I wish.