Skip to content

Commit

Permalink
fix(overmind): also rescope values to action operator
Browse files Browse the repository at this point in the history
  • Loading branch information
christianalfoni committed Jan 17, 2019
1 parent b4d4adb commit 96963d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/node_modules/overmind/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ export class Overmind<Config extends Configuration> implements Configuration {

return mutationTree
},
scopeValue: (value, tree) => {
return this.scopeValue(value, tree)
},
}

return execution
Expand Down Expand Up @@ -950,6 +953,9 @@ export function action<Input, Config extends Configuration = Config>(
}
const maybePromise: any = operation({
...context,
value: IS_PRODUCTION
? context.value
: context.execution.scopeValue(context.value, mutationTree),
state: mutationTree.state,
})

Expand Down
3 changes: 3 additions & 0 deletions packages/node_modules/overmind/src/pipe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ function createMockAction(pipe) {
onMutation() {},
}
},
scopeValue(value) {
return value
},
},
}
pipe(
Expand Down

0 comments on commit 96963d2

Please sign in to comment.