A state can transition to itself: make transition and a second click on the same state connects a self transition, taking it fires On state exited and then On state entered every time, for local and global machines, while Set state into the current state stays silent as before; only states may connect to themselves, every other node is still refused, one self transition per state; the loop is drawn over the middle of the top edge with its arrow pointing down and its name at the apex, the preview already shows it while armed, and the inspector lists it once under Transitions out; new test hook transitionLabelAt, e2e 26e5 (#163)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cc285af10a
commit
010b6a7f6c
12 files changed
+355
-33
No files matched your search
@@ -12,7 +12,8 @@ export const OnStateEntered: NodeDef = {
|
||||
category: 'event',
|
||||
description:
|
||||
"Runs when the machine enters a state, along that state's output. The start state counts as " +
|
||||
'entered when the instance begins; entering the state the machine is already in does not.',
|
||||
'entered when the instance begins. Setting the state the machine is already in does not ' +
|
||||
'count; a transition drawn from a state back into itself does.',
|
||||
inputs: [machinePort()],
|
||||
outputs: [],
|
||||
params: [],
|
||||
|
||||
@@ -23,7 +23,7 @@ export const StateTransition: NodeDef = {
|
||||
const machine = current ? lookup.machine(id) : null;
|
||||
const name = textOf(params[TRANSITION_PARAM] ?? '');
|
||||
const target = machine ? transitionTo(machine, current, name) : '';
|
||||
if (target) setState(ctx, id, target);
|
||||
if (target) setState(ctx, id, target, true);
|
||||
return { next: 'exec' };
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user