Proposal: expose subflow id and name for all its nodes

#1

Hi,

As far as I know, there’s currently no way to configure an instance of the subflow in the flow and the feature described here https://github.com/node-red/node-red/wiki/Design:-subflows-vNext is probably really far away (is anyone working on it?).

I would like to propose a simple change to expose the subflowName (id also to stay consistent with the latest change to expose id and name for the node) for all subflow nodes. With this simple change, we could do a subflow instance customization based on its name.

Let me know what do you think about it, I can send a PR to 0.19.x with it as I already have it working locally.

0 Likes

#2

Can you share more specific details of what you’re proposing?

How are they exposed to nodes within the subflow?

No-one is specifically working on subflow instance properties right now, but it is one of the items on our roadmap to 1.0 - so they will be looked at in the near future.

0 Likes

#3

The subflowName and subflowId would simply be exposed on the current node.

Let's say you have a function Node in your subflow:
image

Now when you place 2 same subflows on the flow, name it differently, nodes in the template will have access to its parents names via node API.

If you ask about the implementation, I updated the Flow.js/createNodeInSubflow function, it takes sfn.id and sfn.nameand sets them on the _node_.

0 Likes

#4

Hi,
any update on my proposal? Should I PR this?

0 Likes