Просмотр исходного кода

fix(core): Prevent error cause by order in outdated state

Michael Bromley 3 лет назад
Родитель
Сommit
2266293583

+ 1 - 1
packages/core/src/common/finite-state-machine/finite-state-machine.ts

@@ -76,7 +76,7 @@ export class FSM<T extends string, Data = any> {
      * Returns an array of state to which the machine may transition from the current state.
      */
     getNextStates(): ReadonlyArray<T> {
-        return this.config.transitions[this._currentState].to;
+        return this.config.transitions[this._currentState]?.to ?? [];
     }
 
     /**