Uibuilder node (copy-paste-rename)

I wanted to make sure I am not missing something in my development process.

I am building a an interface with uibuilder while learning various Vue concepts. Occasionally, I reach what I think of as a milestone and would like to essentially fork that build and start adding new things but maintain the ability to abandon the new path if I screw it up too badly.

In my ideal world, I would be able to copy my uibuilder node, paste it into my flow, then change the URL and start editing with all of the files under the new name being an exact copy of the ones that are under the directory of the old name.

Unfortunately, when I do this, it looks like the paste step creates the new node, but because it shares the same URL as the copied node, then changing the URL moves the files to a new directory, but doesn't leave a copy for the old node.

Is there any efficient way to do what is described in my ideal scenario?

So far, I think I have found the best solution is to this manually in an unusual order:

  1. In the native operating system copy the current nodes folder
  2. In the native operating system paste the copied folder
  3. In the native operating system rename folder to what you want to use as the new URL
  4. In Node-RED place a new uibuilder node
  5. In Node-RED set the new uibuilder node's URL to match the folder name of the new folder

Hi, thanks for sharing this. Funnily enough, I've just been working through the answers to this problem while trying to sort out v5.

At the moment, Node-RED has no direct method that a node can use to distinguish when a node is being copy/pasted or indeed imported. So it took me a while to work around this issue.

However, the good news is that in v5 when you copy/paste a uibuilder node, the resulting paste keeps everything except the URL. That is blanked out. That means that the resulting node is marked with an error triangle and you are prompted to go change it before deploying. If you accidentally deploy anyway, you will get an error and can go fix it, you don't end up with 2 nodes pointing at the same folder. Though if you did, you just need to remember not do delete the underlying folder when asked :slight_smile:

There is still a slight problem in that if you copy/paste a node, don't deploy then copy/paste the new node, you will have the same issue if you don't delete one before deploying. I can't currently find a way around this with the information that node-red currently offers - at least without significant additional coding. But this is a rare edge-case. Hopefully.

Until v5 comes out you have worked out about the best workaround.

A number of annoying bugs in this area are fixed in v5. Previously you could get into a bit of a mess if you added/pasted a uibuilder node and tried to do certain configuration before deploying - such as edit files - since they don't exist until AFTER you have deployed. In v5 that is no longer possible.

There are still another couple of annoying bugs to be ironed out in v5 but hopefully I've at least spotted most of them now. Please do let me know if you find any others.