From 96963d29465c35d14c2112a53f2bab9a9d79e4c2 Mon Sep 17 00:00:00 2001 From: christianalfoni Date: Thu, 17 Jan 2019 21:42:46 +0100 Subject: [PATCH] fix(overmind): also rescope values to action operator --- packages/node_modules/overmind/src/index.ts | 6 ++++++ packages/node_modules/overmind/src/pipe.test.ts | 3 +++ 2 files changed, 9 insertions(+) diff --git a/packages/node_modules/overmind/src/index.ts b/packages/node_modules/overmind/src/index.ts index 02e908b8..2807a1a1 100644 --- a/packages/node_modules/overmind/src/index.ts +++ b/packages/node_modules/overmind/src/index.ts @@ -287,6 +287,9 @@ export class Overmind implements Configuration { return mutationTree }, + scopeValue: (value, tree) => { + return this.scopeValue(value, tree) + }, } return execution @@ -950,6 +953,9 @@ export function action( } const maybePromise: any = operation({ ...context, + value: IS_PRODUCTION + ? context.value + : context.execution.scopeValue(context.value, mutationTree), state: mutationTree.state, }) diff --git a/packages/node_modules/overmind/src/pipe.test.ts b/packages/node_modules/overmind/src/pipe.test.ts index 85b20940..f58d7884 100644 --- a/packages/node_modules/overmind/src/pipe.test.ts +++ b/packages/node_modules/overmind/src/pipe.test.ts @@ -31,6 +31,9 @@ function createMockAction(pipe) { onMutation() {}, } }, + scopeValue(value) { + return value + }, }, } pipe(