Skip to content

Commit 3f23ba7

Browse files
author
David Zukowski
committed
fix(store): fix devTools being applied incorrectly
1 parent f5142e7 commit 3f23ba7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/store/createStore.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { applyMiddleware, createStore } from 'redux'
1+
import { applyMiddleware, compose, createStore } from 'redux'
22
import { routerMiddleware } from 'react-router-redux'
33
import thunk from 'redux-thunk'
44
import makeRootReducer from './reducers'
@@ -10,12 +10,13 @@ export default (initialState = {}, history) => {
1010
const middleware = [thunk, routerMiddleware(history)]
1111

1212
// ======================================================
13-
// Developer Tools
13+
// Store Enhancers
1414
// ======================================================
15+
const enhancers = []
1516
if (__DEBUG__) {
1617
const devToolsExtension = window.devToolsExtension
1718
if (typeof devToolsExtension === 'function') {
18-
middleware.push(devToolsExtension())
19+
enhancers.push(devToolsExtension())
1920
}
2021
}
2122

@@ -25,7 +26,10 @@ export default (initialState = {}, history) => {
2526
const store = createStore(
2627
makeRootReducer(),
2728
initialState,
28-
applyMiddleware(...middleware)
29+
compose(
30+
applyMiddleware(...middleware),
31+
...enhancers
32+
)
2933
)
3034
store.asyncReducers = {}
3135

0 commit comments

Comments
 (0)