To see the problem add a state machine node to the flow and connect it to a debug node.
Open the state machine node, add a state and a transition specification. Leave the Initial Delay at 0.
Deploy and note that the "start" task message appears in the debug pane.
Open the state machine node and add another task. Perform a Modified Nodes deploy. Note that two "start" messages are seen.
Move the debug node a little and Deploy again, again two messages are produced.
If the state node is modified again then the number increases.
Restart node-red and then only one message is seen.
I believe the cause to be incorrect removal of the flows:started event. If the line adding the event
RED.events.on('flows:started', function () {
is changed to
let f;RED.events.on('flows:started', f=function () {
and the line removing it
RED.events.removeListener('flows:started', node.startup)
is changed to
RED.events.removeListener('flows:started', f)
then that appears to fix it. However I am no expert in this area so that may not be the correct way to fix it.
I am using fsm node 1.2.0, NR 3.0.2, nodejs 16.17.0
To see the problem add a state machine node to the flow and connect it to a debug node. Open the state machine node, add a state and a transition specification. Leave the Initial Delay at 0. Deploy and note that the "start" task message appears in the debug pane. Open the state machine node and add another task. Perform a Modified Nodes deploy. Note that two "start" messages are seen. Move the debug node a little and Deploy again, again two messages are produced. If the state node is modified again then the number increases. Restart node-red and then only one message is seen.
I believe the cause to be incorrect removal of the
flows:started
event. If the line adding the eventRED.events.on('flows:started', function () {
is changed tolet f;
RED.events.on('flows:started', f=function () {
and the line removing itRED.events.removeListener('flows:started', node.startup)
is changed toRED.events.removeListener('flows:started', f)
then that appears to fix it. However I am no expert in this area so that may not be the correct way to fix it.I am using fsm node 1.2.0, NR 3.0.2, nodejs 16.17.0