Unexpected Join-node behaviour: Join got triggered N times by N message parts

I'm working on joining multiple inputs into a single trigger message.
However, I noticed that the Join node gets triggered N times by the N message parts.
Please see my test flow below

Screen Shot 2021-09-23 at 10.24.31

The Inject is configured this way:

Screen Shot 2021-09-23 at 10.24.54

The Change nodes look like this:

Screen Shot 2021-09-23 at 10.24.41

Screen Shot 2021-09-23 at 10.29.49

Now the Join node:

I expect the output to contain only one message on one Injection, but what I have got are two messages in sequence.

Screen Shot 2021-09-23 at 10.29.33

What's wrong with my approach?

Further discovery

If I set the second Change to set msg.payload to ..., then the Join gets triggered only once.

My guess

The config of Join using the value of msg.topic as the key actually means

If the input messages of Join have different topics, we'll output these messages in sequence, because a single message can have only one topic.

Am I right?

You have selected And every subsequent message, in the join node. So after two have been received then it sends a message out for every message it gets in.

@Colin Thanks, Colin. But how would you explain my further discovery?

Please export a flow showing the the problem and post it here. See this post for how to do that - How to share code or flow json

@Colin Thanks for the pointer. Pretty new here and haven't figured out the canonical way to share code.

Here is the flow where the two branches trigger Join only once with and every subsequent message checked.

[
    {
        "id": "1233464d307d0b5d",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": ""
    },
    {
        "id": "2d2bac86c2596d2a",
        "type": "inject",
        "z": "1233464d307d0b5d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "src topic",
        "payload": "src payload",
        "payloadType": "str",
        "x": 140,
        "y": 260,
        "wires": [
            [
                "dbcd4dcc8463be89",
                "2228e402fba9335e"
            ]
        ]
    },
    {
        "id": "dbcd4dcc8463be89",
        "type": "change",
        "z": "1233464d307d0b5d",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 340,
        "y": 200,
        "wires": [
            [
                "0e33f1ccdbae667f"
            ]
        ]
    },
    {
        "id": "2228e402fba9335e",
        "type": "change",
        "z": "1233464d307d0b5d",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "topic",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 340,
        "y": 340,
        "wires": [
            [
                "0e33f1ccdbae667f"
            ]
        ]
    },
    {
        "id": "0e33f1ccdbae667f",
        "type": "join",
        "z": "1233464d307d0b5d",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": true,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "num",
        "reduceFixup": "",
        "x": 490,
        "y": 260,
        "wires": [
            [
                "9755c5d1a90b74b0"
            ]
        ]
    },
    {
        "id": "9755c5d1a90b74b0",
        "type": "debug",
        "z": "1233464d307d0b5d",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 260,
        "wires": []
    }
]

Please take a look.

What erroneous behaviour does it show for you?

For me, the very first time after I do a deploy it sends one message the first time I click the inject, and then two messages for every subsequent click, which is the correct behaviour.

Ok, so after a number of message parts is actually meant for the very first trigger after the flow is loaded?

every subsequent message means every individual message arrived from any branch after the trigger from the first load-bang?

@Colin

Yes. If you only want a message every time two messages (with different topics) arrive then unset subsequent messages.