mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-13 05:06:50 +03:00
Merge pull request #18 from gaearon/fix-replace-reducer
Fix replaceReducer to work on the unlifted store
This commit is contained in:
commit
276efcca03
|
@ -191,7 +191,7 @@ function unliftState(liftedState) {
|
||||||
/**
|
/**
|
||||||
* Unlifts the DevTools store to act like the app's store.
|
* Unlifts the DevTools store to act like the app's store.
|
||||||
*/
|
*/
|
||||||
function unliftStore(liftedStore) {
|
function unliftStore(liftedStore, reducer) {
|
||||||
return {
|
return {
|
||||||
...liftedStore,
|
...liftedStore,
|
||||||
devToolsStore: liftedStore,
|
devToolsStore: liftedStore,
|
||||||
|
@ -201,6 +201,12 @@ function unliftStore(liftedStore) {
|
||||||
},
|
},
|
||||||
getState() {
|
getState() {
|
||||||
return unliftState(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) => {
|
return next => (reducer, initialState) => {
|
||||||
const liftedReducer = liftReducer(reducer, initialState);
|
const liftedReducer = liftReducer(reducer, initialState);
|
||||||
const liftedStore = next(liftedReducer);
|
const liftedStore = next(liftedReducer);
|
||||||
const store = unliftStore(liftedStore);
|
const store = unliftStore(liftedStore, reducer);
|
||||||
return store;
|
return store;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user