Clone/share a "modular" subflow

Is there a way to clone a subflow depending on other subflows, without making clones of the deps?

In case someone needs it, here is how I could clone the subflow without cloning nested subflows:

  1. Select an instance of the subflow
  2. Export it
  3. In the exported JSON array remove all node definitions, excluding the one describing the subflow to clone
  4. Clear the in.wires and out.wires arrays
  5. Import the code. This will create a copy of the subflow without nodes content.
  6. Copy/paste the nodes from the original subflow to the cloned one and connect the in/out nodes

It requires some manual work, but still much faster than recreating long lists of env variables.

At the moment it seems impossible to import a node/flow without cloning nested subflows that already exist. Are there any plans on this in Node Red? This will greatly improve flow sharing. If there isn't a way to make the same subflow detection algorithm covering 100% cases, then maybe show a dialog window asking to either create a subflow or use an existing one, pre-selecting the ones looking the same.

already this item on the whiteboard/backlog -

When importing existing subflow with changes, offer to update or clone

Does the item cover subflows without changes (offer to use existing one or clone)?

Maybe. At the moment it's an item on the backlog that hasn't had any more design work on it beyond writing what you've read.

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