Skip to content

Commit ec4bd86

Browse files
Merge branch 'next' of https://github.com/cerebral/overmind into next
2 parents 790db19 + 1c25ed1 commit ec4bd86

File tree

5 files changed

+26
-18
lines changed

5 files changed

+26
-18
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Report BUG
3+
about: If you want support we recommend rather joining the Discord chat at https://discord.gg/CdpmRhQ.
4+
title: "[BUG]"
5+
labels: bug
6+
assignees: 'christianalfoni'
7+
8+
---

packages/node_modules/overmind/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export class Overmind<ThisConfig extends IConfiguration>
318318
nextTick && clearTimeout(nextTick)
319319
nextTick = setTimeout(flushTree, 0)
320320
})
321-
} else if (mode.mode === MODE_DEFAULT) {
321+
} else if (mode.mode === MODE_DEFAULT || mode.mode === MODE_TEST) {
322322
eventHub.on(EventType.OPERATOR_ASYNC, (execution) => {
323323
const flushData = execution.flush(true)
324324
if (this.devtools && flushData.mutations.length) {
@@ -396,6 +396,7 @@ export class Overmind<ThisConfig extends IConfiguration>
396396
[EXECUTION]: true,
397397
parentExecution,
398398
namespacePath,
399+
actionName: name,
399400
getMutationTree: () => {
400401
return this.proxyStateTree.getMutationTree()
401402
},

packages/node_modules/overmind/src/internalTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ export interface Events {
151151

152152
// ============= PRIVATE TYPES FOR APP
153153

154-
export type ResolveState<State extends IState | null> = State extends undefined
155-
? {}
154+
export type ResolveState<State extends IState | null | undefined> = State extends undefined
155+
? State
156156
: {
157157
[P in keyof State]: State[P] extends (parent: ResolveState<IState>, root: any) => any
158158
? ReturnType<State[P]>

packages/node_modules/overmind/src/statemachine.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type Statemachine<States extends string> = {
1111
current: States
1212
reset: () => void
1313
} & {
14-
[State in States]: <T>(entry?: () => T, exit?: () => void) => T
14+
[State in States]: <T extends () => any>(entry?: T, exit?: () => void) => T extends () => infer U ? U : void
1515
}
1616

1717
const CURRENT_EXIT = Symbol('CURRENT_EXIT')
@@ -27,9 +27,9 @@ class StateMachine<States extends string> {
2727
if (definition.states[this.current].includes(key as any)) {
2828
if (this[CURRENT_EXIT]) this[CURRENT_EXIT]()
2929
this[VALUE][CURRENT_EXIT] = exit
30-
this.current = key as any
3130
const tree = (this[PROXY_TREE].master.mutationTree || this[PROXY_TREE])
3231
tree.enableMutations()
32+
this.current = key as any
3333
const result = entry && entry()
3434
tree.blockMutations()
3535

packages/node_modules/overmind/src/types.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@ export type IConfiguration = {
1313
actions?: {}
1414
}
1515

16-
export type IState =
17-
| {
18-
[key: string]:
19-
| IState
20-
| string
21-
| IDerive<any, any, any>
22-
| number
23-
| boolean
24-
| object
25-
| null
26-
| undefined
27-
}
28-
| undefined
16+
export type IState = {
17+
[key: string]:
18+
| IState
19+
| string
20+
| IDerive<any, any, any>
21+
| number
22+
| boolean
23+
| object
24+
| null
25+
| undefined
26+
}
27+
2928

3029
export interface IConfig<ThisConfig extends IConfiguration> {
3130
state: ThisConfig['state'] & {}

0 commit comments

Comments
 (0)