Commit af21ef94947c2173dcf8776b8945d64e93e3402e
Merge pull request #95 from iainkirkpatrick/chore/upgrade-deps
upgrade `react-router-redux`, fix pg configMikey committed on 4/11/2016, 6:43:12 AM
Parent: b80a014a9abc4efe846d5315bc0e897de98a2709
Parent: 8ff89763aa5a55ca923acb5f2228036e30440737
Files changed
app/reducer.js | changed |
app/render-browser.js | changed |
app/store.js | changed |
config/development.js | changed |
package.json | changed |
app/reducer.js | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 | const bulk = require('bulk-require') |
2 | 2 | import { combineReducers } from 'redux' |
3 | -import { routeReducer } from 'redux-simple-router' | |
3 | +import { routerReducer } from 'react-router-redux' | |
4 | 4 | import { map, mapValues, assign, camelCase, mapKeys } from 'lodash' |
5 | 5 | |
6 | 6 | export default combine(assign( |
7 | 7 | mapValues( |
@@ -17,9 +17,9 @@ | ||
17 | 17 | ) |
18 | 18 | ) |
19 | 19 | ), |
20 | 20 | { |
21 | - routing: routeReducer | |
21 | + routing: routerReducer | |
22 | 22 | } |
23 | 23 | )) |
24 | 24 | |
25 | 25 | function combine (reducers) { |
app/render-browser.js | ||
---|---|---|
@@ -1,9 +1,9 @@ | ||
1 | 1 | import React from 'react' |
2 | 2 | import { render } from 'react-dom' |
3 | 3 | import { Provider } from 'react-redux' |
4 | 4 | import { browserHistory as history, Router } from 'react-router' |
5 | -import { syncReduxAndRouter } from 'redux-simple-router' | |
5 | +import { syncHistoryWithStore } from 'react-router-redux' | |
6 | 6 | |
7 | 7 | import createRoutes from 'app/routes' |
8 | 8 | import createStore from 'app/store' |
9 | 9 | import fetchElement from 'app/util/fetch-element' |
@@ -12,11 +12,12 @@ | ||
12 | 12 | var DevTools = require('app/util/dev-tools').default |
13 | 13 | } |
14 | 14 | |
15 | 15 | const store = createStore(window.__data, history) |
16 | +const enhancedHistory = syncHistoryWithStore(history, store) | |
16 | 17 | |
17 | 18 | const main = ( |
18 | - <Router createElement={fetchElement(store)} history={history}> | |
19 | + <Router createElement={fetchElement(store)} history={enhancedHistory}> | |
19 | 20 | { createRoutes(store) } |
20 | 21 | </Router> |
21 | 22 | ) |
22 | 23 |
app/store.js | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 | import { createStore, compose, applyMiddleware } from 'redux' |
2 | 2 | import thunk from 'redux-thunk' |
3 | -import { syncHistory } from 'redux-simple-router' | |
3 | +import { routerMiddleware } from 'react-router-redux' | |
4 | 4 | |
5 | 5 | import reducer from 'app/reducer' |
6 | 6 | |
7 | 7 | if (process.env.NODE_ENV === 'development') { |
@@ -31,12 +31,10 @@ | ||
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | 34 | export default function finalCreateStore(initialState, history) { |
35 | - const historyMiddleware = syncHistory(history) | |
36 | - | |
37 | 35 | const finalMiddleware = middleware.concat([ |
38 | - historyMiddleware | |
36 | + routerMiddleware(history) | |
39 | 37 | ]) |
40 | 38 | |
41 | 39 | const createEnhancedStore = compose( |
42 | 40 | applyMiddleware(...finalMiddleware), |
@@ -44,12 +42,8 @@ | ||
44 | 42 | )(createStore) |
45 | 43 | |
46 | 44 | const store = createEnhancedStore(reducer, initialState) |
47 | 45 | |
48 | - if (process.env.NODE_ENV === 'development') { | |
49 | - historyMiddleware.listenForReplays(store) | |
50 | - } | |
51 | - | |
52 | 46 | if (module.hot) { |
53 | 47 | module.hot.accept('app/reducer', () => { |
54 | 48 | store.replaceReducer(require('app/reducer')) |
55 | 49 | }) |
config/development.js | ||
---|---|---|
@@ -1,4 +1,5 @@ | ||
1 | +const execSync = require('child_process').execSync | |
1 | 2 | const join = require('path').join |
2 | 3 | |
3 | 4 | module.exports = { |
4 | 5 | proxy: { |
@@ -34,9 +35,9 @@ | ||
34 | 35 | }, |
35 | 36 | db: { |
36 | 37 | client: 'pg', |
37 | 38 | connection: { |
38 | - host : 'localhost', | |
39 | + host : process.platform === 'darwin' ? execSync('docker-machine ip default').toString().trim() : 'localhost', | |
39 | 40 | user : 'postgres', |
40 | 41 | //password : 'postgres', |
41 | 42 | database : 'postgres' |
42 | 43 | }, |
package.json | ||
---|---|---|
@@ -133,10 +133,10 @@ | ||
133 | 133 | "react": "^15.0.1", |
134 | 134 | "react-dom": "^15.0.1", |
135 | 135 | "react-redux": "^4.0.1", |
136 | 136 | "react-router": "^2.0.0", |
137 | + "react-router-redux": "^4.0.1", | |
137 | 138 | "redux": "^3.0.5", |
138 | - "redux-simple-router": "2.0.4", | |
139 | 139 | "redux-thunk": "^2.0.1", |
140 | 140 | "reselect": "^2.0.2", |
141 | 141 | "send-data": "^8.0.0", |
142 | 142 | "simple-rc": "^1.0.3", |
Built with git-ssb-web