From acc8d6a1e0a6207a99ddd39d7fdaddbcf2f9d1aa Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 20 Jul 2015 22:42:47 +0300 Subject: [PATCH] Fix replaceReducer to work on the unlifted store --- src/devTools.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/devTools.js b/src/devTools.js index 4d1f2d71..da23cbfd 100644 --- a/src/devTools.js +++ b/src/devTools.js @@ -191,7 +191,7 @@ function unliftState(liftedState) { /** * Unlifts the DevTools store to act like the app's store. */ -function unliftStore(liftedStore) { +function unliftStore(liftedStore, reducer) { return { ...liftedStore, devToolsStore: liftedStore, @@ -201,6 +201,12 @@ function unliftStore(liftedStore) { }, getState() { return unliftState(liftedStore.getState()); + }, + getReducer() { + return reducer; + }, + replaceReducer(nextReducer) { + liftedStore.replaceReducer(liftReducer(nextReducer)); } }; } @@ -242,7 +248,7 @@ export default function devTools() { return next => (reducer, initialState) => { const liftedReducer = liftReducer(reducer, initialState); const liftedStore = next(liftedReducer); - const store = unliftStore(liftedStore); + const store = unliftStore(liftedStore, reducer); return store; }; }