(
machine: T,
...[input]: undefined extends InputFrom<T>
? [input?: InputFrom<T>]
: [input: InputFrom<T>]
)
| 95 | * This is a pure function that does not execute `actions`. |
| 96 | */ |
| 97 | export function getInitialMicrosteps<T extends AnyStateMachine>( |
| 98 | machine: T, |
| 99 | ...[input]: undefined extends InputFrom<T> |
| 100 | ? [input?: InputFrom<T>] |
| 101 | : [input: InputFrom<T>] |
| 102 | ): Array<[SnapshotFrom<T>, ExecutableActionsFrom<T>[]]> { |
| 103 | const actorScope = createInertActorScope(machine); |
| 104 | const initEvent = createInitEvent(input); |
| 105 | const internalQueue: AnyEventObject[] = []; |
| 106 | |
| 107 | const preInitialSnapshot = machine._getPreInitialState( |
| 108 | actorScope, |
| 109 | initEvent, |
| 110 | internalQueue |
| 111 | ); |
| 112 | |
| 113 | const first = initialMicrostep( |
| 114 | machine.root, |
| 115 | preInitialSnapshot, |
| 116 | actorScope, |
| 117 | initEvent, |
| 118 | internalQueue |
| 119 | ); |
| 120 | |
| 121 | const { microsteps } = macrostep( |
| 122 | first[0], |
| 123 | initEvent, |
| 124 | actorScope, |
| 125 | internalQueue |
| 126 | ); |
| 127 | |
| 128 | return [first, ...microsteps] as Array< |
| 129 | [SnapshotFrom<T>, ExecutableActionsFrom<T>[]] |
| 130 | >; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Gets all potential next transitions from the current state. |
no test coverage detected