Skip to content

Commit b0821c0

Browse files
fix(overmind): trigger async event on promise results
1 parent e323ce3 commit b0821c0

File tree

1 file changed

+9
-1
lines changed
  • packages/node_modules/overmind/src

1 file changed

+9
-1
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ export type Action<Value = void> = TAction<App, Value>
3737

3838
export type Context = TContext<App>
3939

40-
export type Derive<Value, Parent = any> = TDerive<App, Value, Parent>
40+
export type Derive<Value, Parent extends object = {}> = TDerive<
41+
App,
42+
Value,
43+
Parent
44+
>
4145

4246
export type Reaction = TReaction<App>
4347

@@ -527,6 +531,10 @@ export function pipe(...operators) {
527531
return next(null, operatorContext)
528532

529533
if (operatorContext.value instanceof Promise) {
534+
context.execution.emit(EventType.OPERATOR_ASYNC, {
535+
...context.execution,
536+
isAsync: true,
537+
})
530538
operatorContext.value
531539
.then((promiseValue) =>
532540
run(null, { ...operatorContext, value: promiseValue })

0 commit comments

Comments
 (0)