Skip to content

Commit 2eedae7

Browse files
fix(overmind): use parent execution for mutation tree and flushing
1 parent 7ed728c commit 2eedae7

File tree

1 file changed

+17
-13
lines changed
  • packages/node_modules/overmind/src

1 file changed

+17
-13
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -410,22 +410,26 @@ export class Overmind<ThisConfig extends IConfiguration>
410410
let currentOperatorId = 0
411411
return () => ++currentOperatorId
412412
})(),
413-
flush: (isAsync?: boolean) => {
414-
return this.proxyStateTree.flush(mutationTrees, isAsync)
415-
},
416-
getMutationTree: () => {
417-
const mutationTree = this.proxyStateTree.getMutationTree()
413+
flush: parentExecution
414+
? parentExecution.flush
415+
: (isAsync?: boolean) => {
416+
return this.proxyStateTree.flush(mutationTrees, isAsync)
417+
},
418+
getMutationTree: parentExecution
419+
? parentExecution.getMutationTree
420+
: () => {
421+
const mutationTree = this.proxyStateTree.getMutationTree()
418422

419-
mutationTrees.push(mutationTree)
423+
mutationTrees.push(mutationTree)
420424

421-
if (this.mode.mode === MODE_TEST) {
422-
mutationTree.onMutation((mutation) => {
423-
this.addExecutionMutation(mutation)
424-
})
425-
}
425+
if (this.mode.mode === MODE_TEST) {
426+
mutationTree.onMutation((mutation) => {
427+
this.addExecutionMutation(mutation)
428+
})
429+
}
426430

427-
return mutationTree
428-
},
431+
return mutationTree
432+
},
429433
scopeValue: (value, tree) => {
430434
return this.scopeValue(value, tree)
431435
},

0 commit comments

Comments
 (0)