Link-out link-in in subflows, after copy

to make problem even clear: here is two "different" subflow, one was forked "long ago" from another:

import me to next node
[
    {
        "id": "4875d2d320e854a1",
        "type": "subflow",
        "name": "Subflow 2",
        "info": "",
        "in": [],
        "out": []
    },
    {
        "id": "3c6908f4a035f01f",
        "type": "function",
        "z": "4875d2d320e854a1",
        "name": "function 3",
        "func": "\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 200,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "99aedb3212b835d3",
        "type": "subflow:4875d2d320e854a1",
        "z": "3c4154b39eca0635",
        "name": "",
        "x": 360,
        "y": 980,
        "wires": []
    }
]
I was same as above, but evolved
[
    {
        "id": "4875d2d320e854a1",
        "type": "subflow",
        "name": "after long time",
        "info": "",
        "category": "",
        "in": [],
        "out": [],
        "env": [],
        "meta": {},
        "color": "#DDAA99"
    },
    {
        "id": "bbb901cbbf7830bb",
        "type": "debug",
        "z": "4875d2d320e854a1",
        "name": "debug 2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 240,
        "y": 120,
        "wires": []
    },
    {
        "id": "99aedb3212b835d3",
        "type": "subflow:4875d2d320e854a1",
        "z": "3c4154b39eca0635",
        "name": "",
        "x": 370,
        "y": 980,
        "wires": []
    }
]
upd: playing further with this, it seems I break whole test project :) I have subflows without usage and unable to delete (no delete item in all subflows menu)... can't share it right now, because it have some private info inside, will try to repeat on fresh project.

Moderator's note. Backticks added around second one to make it possible to import.

When you imported, what did you do when it said
image

If you said View nodes what did you do here?
image

I checking both boxes here, because last one only , will just try spawn instance of subflow2 with name "after long time" , not new one with "debug" inside.
like here
image

upd2: the fail of project seems fake, i did nothing and it works now, may be just unrelated glitch, sorry :frowning:

but import reports valid - I can import "subflow" to top and copy to inside subflow, but can't import just inside subflow, so I suspect it checking not ready data.

If the example you posted is no longer failing for you then please post another example we can try to see the problem.

When exporting a flow to paste here, if you go to the JSON tab and select Compact mode then when you paste it here it will be compressed into one line so there is not need to use the Details tag to hide it.

Examples still valid, there is no "fatal bug" I "saw" before.

Let me try to explain again, how to repeat and what I think wrong:

step by step:

  1. create a function, convert it to subflow
  2. select function press ctl+e and copy
  3. enter inside subflow
  4. press ctrl+i, ctrl+v, import
  5. select view nodes
  6. in dialog press all checkboxes on the left side, to clone pasted content
  7. get error
  8. return to top flow
  9. do 4-6 steps
  10. notice no error
  11. select just imported subflow, press ctrl+c, delete (not necessary, just to not mess)
  12. enter initial subflow, press ctrl+v
  13. notice no error

what is wrong ?
I think that steps 4-6 shall not give the error in first place, because object created by step 9-12 - same and It could be inserted inside subflow. Most probably it calculating loops on initial ids, not ones, which will be inserted after import dialog.


subflow shall be like this:

[{"id":"9b7621151191cd70","type":"subflow","name":"base","info":"","category":"","in":[],"out":[],"env":[],"meta":{},"color":"#DDAA99"},{"id":"2159c5b297e6e392","type":"function","z":"9b7621151191cd70","name":"function 1","func":"\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":200,"y":80,"wires":[[]]},{"id":"646f3a89d91a9570","type":"subflow:9b7621151191cd70","z":"f1158b386bfe8525","name":"","x":410,"y":160,"wires":[]}]

btw: can I publish subflow as live subflow in forum ?

If the example is still valid then why try to explain again other than using your example? What have I got to do with your earlier two flows to see the problem?

I don't understand what you mean by that.

I don't understand what you mean by that.

I saw on some resources of node-red , the sample code interpreted and shows flows instead of json, just asked you if I can do this in forum, nvm.

If the example is still valid then why try to explain again other than using your example? What have I got to do with your earlier two flows to see the problem?

I don't know :slight_smile: I just trying to ensure that you understand what happening, I just provided step-by step instruction how to repeat it from scratch. Flow examples not really help there, because it is interface behaviour.

May be we shall start different thread

For the step 13 - I have the same error message.

I don't understand if you have strange behavior or if you don't understand why this error message appears :thinking:

For the step 13 - I have the same error message.
Hm, did you checked both checkboxes like here ?

image

doing step 4 after 8 ? (i.e. import to top flow and tick both checkboxes)

There shall be no error after ctrl+v

to be clear here is Subflow1 in fresh project made this way:

[{"id":"7f6bebc268a4daa9","type":"subflow","name":"Subflow 1","info":"","in":[],"out":[]},{"id":"3ed2712b31168e34","type":"function","z":"7f6bebc268a4daa9","name":"function 2","func":"\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":200,"y":80,"wires":[[]]},{"id":"c31d72ad7524be44","type":"subflow","name":"Subflow 1","info":"","in":[],"out":[]},{"id":"74f70d42dab1e56f","type":"function","z":"c31d72ad7524be44","name":"function 2","func":"\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":200,"y":80,"wires":[[]]},{"id":"63f7ebb05541261c","type":"subflow:7f6bebc268a4daa9","z":"c31d72ad7524be44","x":300,"y":160,"wires":[]},{"id":"9dbbbc045f6ae20f","type":"subflow:c31d72ad7524be44","z":"1d4758612c37d417","name":"","x":280,"y":1040,"wires":[]}]

Ok yes sorry misreading the step 11.

So it's normal that there is no error message because you are not importing a subflow to itself. The subflow of step 11 contains only the function node. If you do it with the initial subflow, you would have in that subflow the function node and itself, which is not possible unless you are Christopher Nolan.

Yes, my question, why I can't import to subflow ?

In my mind it shall be the same as import to top, if I checked those both checkboxes. Because I believe it shall create ids first, and than check collision second stage (1st stage is when you asked to decide copy/replace/make ponter) . (so it shall don't know iniitial ids of imported json)

Mmm I see now what you mean. Sorry :sweat_smile:

@knolleary the behavior of the View nodes and Import copy buttons differs.

Import copy keeps the original subflow while View nodes creates a copy. Is it correct?

I apologize as this thread should have been splitted a long time ago. Can an admin do this? Thanks.

1 Like

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