Skip to content

Commit 3a62624

Browse files
fix(overmind): fix action end event in production
1 parent 791ee89 commit 3a62624

File tree

1 file changed

+34
-34
lines changed
  • packages/node_modules/overmind/src

1 file changed

+34
-34
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -448,40 +448,40 @@ export class Overmind<ThisConfig extends IConfiguration>
448448
value: safeValue(value),
449449
})
450450

451-
action[IS_OPERATOR]
452-
? action(
453-
null,
454-
{
455-
value,
456-
state: this.proxyStateTree.state,
457-
actions: this.actions,
458-
execution,
459-
effects: this.trackEffects(this.effects, execution),
460-
},
461-
(err, finalContext) => {
462-
finalContext &&
463-
this.eventHub.emit(EventType.ACTION_END, {
464-
...finalContext.execution,
465-
operatorId: finalContext.execution.operatorId - 1,
466-
isIntercepted: finalContext.isIntercepted,
467-
})
468-
if (err) reject(err)
469-
else
470-
resolve(
471-
this.mode.mode === MODE_TEST
472-
? finalContext.execution
473-
: undefined
474-
)
475-
}
476-
)
477-
: resolve(
478-
action(
479-
this.createContext(execution, execution.getMutationTree()),
480-
value
481-
)
482-
? undefined
483-
: undefined
484-
)
451+
if (action[IS_OPERATOR]) {
452+
action(
453+
null,
454+
{
455+
value,
456+
state: this.proxyStateTree.state,
457+
actions: this.actions,
458+
execution,
459+
effects: this.trackEffects(this.effects, execution),
460+
},
461+
(err, finalContext) => {
462+
finalContext &&
463+
this.eventHub.emit(EventType.ACTION_END, {
464+
...finalContext.execution,
465+
operatorId: finalContext.execution.operatorId - 1,
466+
isIntercepted: finalContext.isIntercepted,
467+
})
468+
if (err) reject(err)
469+
else
470+
resolve(
471+
this.mode.mode === MODE_TEST
472+
? finalContext.execution
473+
: undefined
474+
)
475+
}
476+
)
477+
} else {
478+
action(
479+
this.createContext(execution, execution.getMutationTree()),
480+
value
481+
)
482+
this.eventHub.emit(EventType.ACTION_END, execution)
483+
resolve()
484+
}
485485
})
486486
} else {
487487
const execution = {

0 commit comments

Comments
 (0)