Skip to content

Commit c449e0e

Browse files
fix(overmind): fix issue with statechart action not returning promise
1 parent c68353c commit c449e0e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/node_modules/overmind/src/config/statechart.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ export function statechart<C extends IConfiguration, Charts extends Statecharts
371371
// If there are no new transition target, just drop moving on, just run the action
372372
if (!transitionActions.some((transitionAction) => transitionAction.target)) {
373373
if (config.actions) {
374-
actionsTarget[ACTIONS][key](payload)
374+
return actionsTarget[ACTIONS][key](payload)
375375
}
376376
return
377377
}
@@ -455,9 +455,9 @@ export function statechart<C extends IConfiguration, Charts extends Statecharts
455455
})
456456

457457
currentTransitionAction = key
458-
// Run the action that caused the transition
458+
let actionResult;
459459
if (config.actions) {
460-
actionsTarget[ACTIONS][key](payload)
460+
actionResult = actionsTarget[ACTIONS][key](payload)
461461
}
462462

463463
currentTransitionAction = null
@@ -489,6 +489,8 @@ export function statechart<C extends IConfiguration, Charts extends Statecharts
489489
},
490490
})
491491
}
492+
493+
return actionResult
492494
})
493495
)
494496

0 commit comments

Comments
 (0)