From c1551f6f03b58a271c38ac533cff1d65ebfdec04 Mon Sep 17 00:00:00 2001 From: Mihail Diordiev Date: Wed, 2 Nov 2016 10:43:18 +0200 Subject: [PATCH] feat(core): Update Redux DevTools Extension's usage according to new API (#1129) --- app/app.js | 9 --------- app/store.js | 9 ++++++--- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/app/app.js b/app/app.js index c458452ef2..7a20243ec9 100644 --- a/app/app.js +++ b/app/app.js @@ -50,15 +50,6 @@ import { translationMessages } from './i18n'; const initialState = {}; const store = configureStore(initialState, browserHistory); -// If you use Redux devTools extension, since v2.0.1, they added an -// `updateStore`, so any enhancers that change the store object -// could be used with the devTools' store. -// As this boilerplate uses Redux & Redux-Saga, the `updateStore` is needed -// if you want to `take` actions in your Sagas, dispatched from devTools. -if (window.devToolsExtension) { - window.devToolsExtension.updateStore(store); -} - // Sync history and store, as the react-router-redux reducer // is under the non-default key ("routing"), selectLocationState // must be provided for resolving how to retrieve the "route" in the state diff --git a/app/store.js b/app/store.js index eec3111dae..7e6eb81ccf 100644 --- a/app/store.js +++ b/app/store.js @@ -9,7 +9,6 @@ import createSagaMiddleware from 'redux-saga'; import createReducer from './reducers'; const sagaMiddleware = createSagaMiddleware(); -const devtools = window.devToolsExtension || (() => (noop) => noop); export default function configureStore(initialState = {}, history) { // Create the store with two middlewares @@ -22,13 +21,17 @@ export default function configureStore(initialState = {}, history) { const enhancers = [ applyMiddleware(...middlewares), - devtools(), ]; + // If Redux DevTools Extension is installed use it, otherwise use Redux compose + /* eslint-disable no-underscore-dangle */ + const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; + /* eslint-enable */ + const store = createStore( createReducer(), fromJS(initialState), - compose(...enhancers) + composeEnhancers(...enhancers) ); // Extensions