Do not use persistState for explorev2 (#1894)

* Do not use persistState for explorev2

* Change enhancerWithPersistState to enhancer and function name to initEnhancer
This commit is contained in:
vera-liu
2017-01-03 20:23:43 -08:00
committed by GitHub
parent a1e3fc1c23
commit 9bc7ad9cd5
3 changed files with 8 additions and 8 deletions

View File

@@ -64,15 +64,15 @@ export function addToArr(state, arrKey, obj) {
return Object.assign({}, state, newState);
}
export function enhancer() {
let enhancerWithPersistState = compose(persistState());
export function initEnhancer(persist = true) {
let enhancer = persist ? compose(persistState()) : compose();
if (process.env.NODE_ENV === 'dev') {
/* eslint-disable no-underscore-dangle */
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
/* eslint-enable */
enhancerWithPersistState = composeEnhancers(persistState());
enhancer = persist ? composeEnhancers(persistState()) : composeEnhancers();
}
return enhancerWithPersistState;
return enhancer;
}
export function areArraysShallowEqual(arr1, arr2) {