Skip to content

Commit c7fceaa

Browse files
fix(overmind): use parent execution mutation tree
1 parent 041c4ac commit c7fceaa

File tree

1 file changed

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

1 file changed

+13
-10
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ export class Overmind<ThisConfig extends IConfiguration>
386386
private createExecution(name, action, parentExecution) {
387387
if (IS_PRODUCTION) {
388388
return ({
389+
parentExecution,
389390
getMutationTree: () => {
390391
return this.proxyStateTree.getMutationTree()
391392
},
@@ -412,19 +413,21 @@ export class Overmind<ThisConfig extends IConfiguration>
412413
flush: () => {
413414
return this.proxyStateTree.flush(mutationTrees)
414415
},
415-
getMutationTree: () => {
416-
const mutationTree = this.proxyStateTree.getMutationTree()
416+
getMutationTree: parentExecution
417+
? parentExecution.getMutationTree
418+
: () => {
419+
const mutationTree = this.proxyStateTree.getMutationTree()
417420

418-
mutationTrees.push(mutationTree)
421+
mutationTrees.push(mutationTree)
419422

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

426-
return mutationTree
427-
},
429+
return mutationTree
430+
},
428431
scopeValue: (value, tree) => {
429432
return this.scopeValue(value, tree)
430433
},

0 commit comments

Comments
 (0)