From 653627033a832b533ffcc0bb5691f9fac258b554 Mon Sep 17 00:00:00 2001 From: Alfred Melch Date: Sat, 1 Feb 2020 18:09:03 +0100 Subject: [PATCH] Pass whole action to reducerBranch --- lib/potent-reducer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/potent-reducer.js b/lib/potent-reducer.js index 7b22b59..a8a4078 100644 --- a/lib/potent-reducer.js +++ b/lib/potent-reducer.js @@ -39,9 +39,9 @@ export const createStore = options => { function makeReducerFn(reducer, { onUpdate, logging }) { const noop = state => state return (prevState, action) => { - const { type, ...payload } = action + const { type } = action const reducerBranch = reducer[type] || reducer['default'] || noop - const nextState = reducerBranch(prevState, payload) + const nextState = reducerBranch(prevState, action) const stats = { prevState, nextState, action } typeof onUpdate === 'function' && onUpdate(stats) if (logging) logger(stats)