ID Uniqueness when importing nodes

Hello forum,

I would have preferred opening this on Github as a FR, but here we go:

We do have a software which can create Node-RED nodes via a JSON export. So the software creates a node with a certain ID. According to the documentation these node IDs get replaced (some remapping for config nodes also).

My understanding is that this behaviour is in place to avoid issues when importing nodes from any source so it wont break. But what if you intend to replace an existing node (matching by node id and type)? Is there any way nodes can override an already existing node?

If not: I would propose a flag when importing nodes via the import menu: "Replace existing duplicate nodes" which is off by default to match the current behaviour. If the flag is set, the import script will take care of some sanity checking and rewiring and replace the node with the new node.

This behaviour is relevant to normal nodes and config nodes.


Thank you for reading our contribution guidelines and asking the question here instead. We do not use the github issue list as a backlog of feature requests.

Better handling of duplicates when importing a flow is something that has been on the todo list for a while - you aren't the first to raise it.

I thought we had it captured on the backlog, but I couldn't find it, so have added it -

Thank you for the reply. I took a brief look at the import function of Node-RED and its a monster.

I am thinking about doing something about it, but I feel that a rework of the whole would be good. What are your thoughts on that?

It depends entirely on what you are thinking of doing.

Reworking the function for the sake of it would not be welcome. It has to do a lot of work to properly import nodes. Any refactoring would need to be done with a huge amount of care.

I would prefer to start with a discussion over what the desired behaviour is. Jumping into the code before we know what we want it to do would be premature.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.