Skip to content

Commit e2b5e45

Browse files
fix(overmind): actions should await result
1 parent a5554d8 commit e2b5e45

File tree

1 file changed

+5
-4
lines changed
  • packages/node_modules/overmind/src

1 file changed

+5
-4
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,9 @@ export class Overmind<Config extends Configuration> implements Configuration {
339339
}
340340
private createAction(name, action) {
341341
this.actionReferences.push(action)
342-
const actionFunc = (value?) => {
342+
const actionFunc = async (value?) => {
343343
if (IS_PRODUCTION || action[IS_OPERATOR]) {
344-
return new Promise((resolve, reject) => {
344+
await new Promise((resolve, reject) => {
345345
const execution = this.createExecution(name, action)
346346
this.eventHub.emit(EventType.ACTION_START, execution)
347347

@@ -377,6 +377,7 @@ export class Overmind<Config extends Configuration> implements Configuration {
377377
: undefined
378378
)
379379
})
380+
380381
} else {
381382
const execution = {
382383
...this.createExecution(name, action),
@@ -423,8 +424,8 @@ export class Overmind<Config extends Configuration> implements Configuration {
423424
result: undefined,
424425
})
425426
this.eventHub.emit(EventType.ACTION_END, execution)
426-
427-
return Promise.resolve(this.options.testMode && execution)
427+
await result
428+
return this.options.testMode && execution
428429
}
429430
}
430431

0 commit comments

Comments
 (0)