Skip to content

Commit

Permalink
chore(root): replaced react-router-redux w/ connected-react-router
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurice Dalderup authored and Maurice Dalderup committed Oct 21, 2018
1 parent 8e59905 commit 7fa0e53
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"bluebird": "^3.3.4",
"bs58": "^4.0.1",
"classnames": "^2.1.3",
"connected-react-router": "^4.5.0",
"eslint-cli": "^1.1.1",
"history": "^4.7.2",
"lodash": "^4.17.11",
Expand All @@ -80,7 +81,6 @@
"react-redux": "^5.0.6",
"react-router": "^4.3.1",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.9",
"redux": "^3.7.2",
"redux-form": "^7.2.3",
"redux-thunk": "^2.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app/containers/Root/dev.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Provider } from 'react-redux'
import { ConnectedRouter } from 'react-router-redux'
import { ConnectedRouter } from 'connected-react-router'
import DevTools from '../DevTools'
import App from '../App'
import PopupWindow from '../PopupWindow'
Expand Down
2 changes: 1 addition & 1 deletion src/app/containers/Root/prod.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Provider } from 'react-redux'
import { ConnectedRouter } from 'react-router-redux'
import { ConnectedRouter } from 'connected-react-router'
import App from '../App'
import PopupWindow from '../PopupWindow'
import { history } from '../../store/configureStore'
Expand Down
2 changes: 0 additions & 2 deletions src/app/reducers/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { combineReducers } from 'redux'
import { routerReducer } from 'react-router-redux'
import { reducer as formReducer } from 'redux-form'

import account from './account'
Expand All @@ -11,5 +10,4 @@ export default combineReducers({
config,
wallet,
form: formReducer,
router: routerReducer,
})
4 changes: 2 additions & 2 deletions src/app/store/configureStore.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import rootReducer from '../reducers'
import storage from '../utils/storage'
import DevTools from '../containers/DevTools'
import createHistory from 'history/createBrowserHistory'
import { routerMiddleware } from 'react-router-redux'
import { connectRouter, routerMiddleware } from 'connected-react-router'

export const history = createHistory()

Expand Down Expand Up @@ -35,7 +35,7 @@ export default function(initialState) {
if (initialState.router && initialState.router.location) {
history.location = initialState.router.location
}
const store = createStore(rootReducer, initialState, enhancer)
const store = createStore(connectRouter(history)(rootReducer), initialState, enhancer)

if (module.hot) {
module.hot.accept('../reducers', () => {
Expand Down
9 changes: 6 additions & 3 deletions src/app/store/configureStore.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ import thunk from 'redux-thunk'
import rootReducer from '../reducers'
import storage from '../utils/storage'
import createHistory from 'history/createBrowserHistory'
import { routerMiddleware } from 'react-router-redux'
import { connectRouter, routerMiddleware } from 'connected-react-router'

export const history = createHistory()

const enhancer = compose(applyMiddleware(...[thunk, routerMiddleware(history)]), storage())
const enhancer = compose(
applyMiddleware(...[thunk, routerMiddleware(history)]),
storage()
)

export default function(initialState) {
if (initialState.router && initialState.router.location) {
history.location = initialState.router.location
}

return createStore(rootReducer, initialState, enhancer)
return createStore(connectRouter(history)(rootReducer), initialState, enhancer)
}

0 comments on commit 7fa0e53

Please sign in to comment.