summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chabbert <chabbertvi@eisti.eu>2016-12-18 18:06:04 +0100
committerVictor Chabbert <chabbertvi@eisti.eu>2016-12-18 18:06:04 +0100
commitef8dcf4313b8ef47a364e10d7014ea2c1a728a00 (patch)
tree475661e209c2f6332542eceb4287dbdb4847145c
parentAdd react-router with small example (diff)
downloadseven-wonders-ef8dcf4313b8ef47a364e10d7014ea2c1a728a00.tar.gz
seven-wonders-ef8dcf4313b8ef47a364e10d7014ea2c1a728a00.tar.bz2
seven-wonders-ef8dcf4313b8ef47a364e10d7014ea2c1a728a00.zip
Update redux-devtools extension integration
-rw-r--r--src/main/js/src/index.js4
-rw-r--r--src/main/js/src/store.js11
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
bgstack15