File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -82,15 +82,22 @@ export class BackgroundApp {
8282 ipcMain . on ( DirectStateTransition , ( e , id : string ) => {
8383 console . log ( 'Direct state transition' ) ;
8484 const index = SymbolIndex . getIndex ( this . project . projectSymbols ) ;
85+ const lastState = this . states [ this . states . length - 1 ] ;
8586 const nextState = index . get ( id ) ;
8687 if ( nextState ) {
87- this . states . push ( nextState . stateFactory ( ) ) ;
88- console . log ( 'Found next state' ) ;
89- success ( e . sender , DirectStateTransition , true ) ;
90- } else {
91- console . log ( 'No next state' ) ;
92- error ( e . sender , DirectStateTransition , false ) ;
88+ let state : State | null = nextState . stateFactory ( ) ;
89+ if ( lastState instanceof state . constructor ) {
90+ state = lastState . nextState ( id ) ;
91+ }
92+ if ( state ) {
93+ this . states . push ( state ) ;
94+ console . log ( 'Found next state' ) ;
95+ success ( e . sender , DirectStateTransition , true ) ;
96+ return ;
97+ }
9398 }
99+ console . log ( 'No next state' ) ;
100+ error ( e . sender , DirectStateTransition , false ) ;
94101 } ) ;
95102
96103 ipcMain . on ( GetSymbols , e => {
You can’t perform that action at this time.
0 commit comments