From ef8dcf4313b8ef47a364e10d7014ea2c1a728a00 Mon Sep 17 00:00:00 2001 From: Victor Chabbert Date: Sun, 18 Dec 2016 18:06:04 +0100 Subject: Update redux-devtools extension integration --- src/main/js/src/index.js | 4 ---- src/main/js/src/store.js | 11 +++++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/js/src/index.js b/src/main/js/src/index.js index 31ddded9..cfe654b5 100644 --- a/src/main/js/src/index.js +++ b/src/main/js/src/index.js @@ -7,10 +7,6 @@ import configureStore from './store' const initialState = {} const store = configureStore(initialState) -if (window.devToolsExtension) { - window.devToolsExtension.updateStore(store) -} - import './index.css' import App from './containers/App' diff --git a/src/main/js/src/store.js b/src/main/js/src/store.js index 8cf7fa21..d4885275 100644 --- a/src/main/js/src/store.js +++ b/src/main/js/src/store.js @@ -2,19 +2,22 @@ import { createStore, compose } from 'redux' import createReducer from './reducers' -const devtools = window.devToolsExtension || (() => noop => noop) - export default function configureStore(initialState = {}) { const middlewares = [] const enhancers = [ - devtools() ] + const composeEnhancers = + process.env.NODE_ENV !== 'production' && + typeof window === 'object' && + window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? + window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : compose; + const store = createStore( createReducer(), initialState, - compose(...enhancers) + composeEnhancers(...enhancers) ) return store -- cgit