Skip to content

Commit 276efcc

Browse files
committed
Merge pull request #18 from gaearon/fix-replace-reducer
Fix replaceReducer to work on the unlifted store
2 parents 6b44656 + acc8d6a commit 276efcc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/devTools.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ function unliftState(liftedState) {
191191
/**
192192
* Unlifts the DevTools store to act like the app's store.
193193
*/
194-
function unliftStore(liftedStore) {
194+
function unliftStore(liftedStore, reducer) {
195195
return {
196196
...liftedStore,
197197
devToolsStore: liftedStore,
@@ -201,6 +201,12 @@ function unliftStore(liftedStore) {
201201
},
202202
getState() {
203203
return unliftState(liftedStore.getState());
204+
},
205+
getReducer() {
206+
return reducer;
207+
},
208+
replaceReducer(nextReducer) {
209+
liftedStore.replaceReducer(liftReducer(nextReducer));
204210
}
205211
};
206212
}
@@ -242,7 +248,7 @@ export default function devTools() {
242248
return next => (reducer, initialState) => {
243249
const liftedReducer = liftReducer(reducer, initialState);
244250
const liftedStore = next(liftedReducer);
245-
const store = unliftStore(liftedStore);
251+
const store = unliftStore(liftedStore, reducer);
246252
return store;
247253
};
248254
}

0 commit comments

Comments
 (0)