Skip to content

Commit 96963d2

Browse files
fix(overmind): also rescope values to action operator
1 parent b4d4adb commit 96963d2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ export class Overmind<Config extends Configuration> implements Configuration {
287287

288288
return mutationTree
289289
},
290+
scopeValue: (value, tree) => {
291+
return this.scopeValue(value, tree)
292+
},
290293
}
291294

292295
return execution
@@ -950,6 +953,9 @@ export function action<Input, Config extends Configuration = Config>(
950953
}
951954
const maybePromise: any = operation({
952955
...context,
956+
value: IS_PRODUCTION
957+
? context.value
958+
: context.execution.scopeValue(context.value, mutationTree),
953959
state: mutationTree.state,
954960
})
955961

packages/node_modules/overmind/src/pipe.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ function createMockAction(pipe) {
3131
onMutation() {},
3232
}
3333
},
34+
scopeValue(value) {
35+
return value
36+
},
3437
},
3538
}
3639
pipe(

0 commit comments

Comments
 (0)