git ssb

1+

dinoworm ๐Ÿ› / catstack



Commit ee357b9441a7fbb11be1a0d26b0a899624a2b155

general improvements, but stuck on a redux-router error

Michael Williams committed on 11/28/2015, 11:48:37 AM
Parent: a34eabee8f1d06d0d8190fdc09d638f544d00dca

Files changed

app/client.jschanged
app/containers/app.jschanged
app/containers/no-match.jschanged
app/containers/root.jschanged
app/containers/todos.jschanged
app/containers/dev-tools.jsdeleted
app/reducers/index.jschanged
app/reducers/todos.jschanged
app/state.jschanged
app/store.jschanged
app/components/dev-tools.jsadded
package.jsonchanged
app/client.jsView
@@ -4,15 +4,15 @@
44 import { reduxReactRouter, routerStateReducer, ReduxRouter } from 'redux-router';
55 const { Provider } = require('react-redux')
66 const thunk = require('redux-thunk')
77
8-const createInitialState = require('app/state')
8+const initialState = require('app/state')
99 const configureStore = require('app/store')
1010 const { getAllTodos } = require('app/actions')
1111 const Root = require('app/containers/root')
1212
1313 const store = configureStore(
14- createInitialState()
14+ initialState
1515 )
1616
1717 //store.dispatch(getAllTodos())
1818
app/containers/app.jsView
@@ -12,7 +12,6 @@
1212 }
1313 }
1414
1515 module.exports = connect(
16- App,
1716 (state) => { return {} }
18-)
17+)(App)
app/containers/no-match.jsView
@@ -9,7 +9,6 @@
99 }
1010 }
1111
1212 module.exports = connect(
13- NoMatch,
1413 (state) => { return {} }
15-)
14+)(NoMatch)
app/containers/root.jsView
@@ -4,9 +4,9 @@
44
55 const routes = require('app/routes')
66
77 if (process.env.NODE_ENV === 'development') {
8- var DevTools = require('app/containers/dev-tools')
8+ var DevTools = require('app/components/dev-tools')
99 }
1010
1111 class Root extends React.Component {
1212 render() {
app/containers/todos.jsView
@@ -9,7 +9,6 @@
99 }
1010 }
1111
1212 module.exports = connect(
13- Todos,
1413 (state) => { return {} }
15-)
14+)(Todos)
app/containers/dev-tools.jsView
@@ -1,14 +1,0 @@
1-const React = require('react')
2-const { createDevTools } = require('redux-devtools')
3-const LogMonitor = require('redux-devtools-log-monitor')
4-const DockMonitor = require('redux-devtools-dock-monitor')
5-
6-const DevTools = createDevTools(
7- <DockMonitor toggleVisibilityKey='H'
8- changePositionKey='Q'>
9- <LogMonitor />
10- </DockMonitor>
11-)
12-
13-module.exports = DevTools
14-
app/reducers/index.jsView
@@ -1,6 +1,8 @@
11 const bulk = require('bulk-require')
22 const { combineReducers } = require('redux')
3+const { routerStateReducer } = require('redux-router')
34
4-module.exports = combineReducers(
5- bulk(__dirname, '*.js')
6-)
5+module.exports = combineReducers({
6+ ...bulk(__dirname, '!(index.js)'),
7+ router: routerStateReducer
8+})
app/reducers/todos.jsView
@@ -1,7 +1,9 @@
1+const initialState = require('app/state')
2+
13 module.exports = todos
24
3-function todos (state = {}, action) {
5+function todos (state = initialState, action) {
46 switch (action.type) {
57 case 'ADD_TODO':
68 return {
79 ...state,
app/state.jsView
@@ -1,9 +1,3 @@
1-module.exports = createInitialState
2-
3-function createInitialState () {
4- const initialState = {
5- todos: {}
6- }
7-
8- return initialState
1+module.exports = {
2+ todos: {}
93 }
app/store.jsView
@@ -3,49 +3,51 @@
33 const logger = require('redux-logger')
44 const { reduxReactRouter, routerStateReducer, ReduxRouter } = require('redux-router')
55 const { createHistory } = require('history')
66
7-const rootReducer = require('app/reducers')
7+const reducer = require('app/reducers')
88 const routes = require('routes')
99
10-let storesEnhancers = []
10+let storeEnhancers = []
1111 let middleware = []
1212
1313 middleware.push(thunk)
1414
1515 if (process.env.NODE_ENV === 'development') {
1616 var { persistState } = require('redux-devtools')
1717
18- var DevTools = require('app/containers/dev-tools')
19-
20- middleware.push(logger())
18+ var DevTools = require('app/components/dev-tools')
2119 }
2220
23-storesEnhancers.push(
21+storeEnhancers.push(
2422 applyMiddleware(...middleware)
2523 )
2624
25+storeEnhancers.push(
26+ reduxReactRouter({
27+ routes, createHistory
28+ })
29+)
30+
2731 if (process.env.NODE_ENV === 'development') {
28- storesEnhancers.push(DevTools.instrument())
29- storesEnhancers.push(persistState(
32+
33+ storeEnhancers.push(
34+ applyMiddleware(logger())
35+ )
36+ storeEnhancers.push(DevTools.instrument())
37+ storeEnhancers.push(persistState(
3038 window.location.href.match(
3139 /[?&]debug_session=([^&]+)\b/
3240 )
3341 ))
3442 }
3543
36-storesEnhancers.push(
37- reduxReactRouter({
38- routes, createHistory
39- })
40-)
41-
42-const finalCreateStore = compose(
43- ...storesEnhancers
44+const createEnhancedStore = compose(
45+ ...storeEnhancers
4446 )(createStore)
4547
4648 function configureStore(initialState) {
47- const store = finalCreateStore(rootReducer, initialState)
49+ const store = createEnhancedStore(reducer, initialState)
4850
4951 if (process.env.NODE_ENV === 'development') {
5052 if (module.hot) {
5153 module.hot.accept('app/reducers', () =>
app/components/dev-tools.jsView
@@ -1,0 +1,13 @@
1+const React = require('react')
2+const { createDevTools } = require('redux-devtools')
3+const LogMonitor = require('redux-devtools-log-monitor')
4+const DockMonitor = require('redux-devtools-dock-monitor')
5+
6+const DevTools = createDevTools(
7+ <DockMonitor toggleVisibilityKey='H'
8+ changePositionKey='Q'>
9+ <LogMonitor />
10+ </DockMonitor>
11+)
12+
13+module.exports = DevTools
package.jsonView
@@ -9,9 +9,9 @@
99 "format": "snazzy --format",
1010 "test": "(npm run spec & npm run feature)",
1111 "spec": "node spec",
1212 "feature": "node feature",
13- "dev:client": "budo client --dir assets --serve bundle.js --live -- -dv",
13+ "dev:client": "budo client --dir assets --serve bundle.js --live --pushstate -- -dv",
1414 "dev:assets": "cpx \"app/assets/**/*\" assets -w",
1515 "dev:server": "nodemon server",
1616 "prod:client": "browserify client -o assets/bundle.js -g uglifyify",
1717 "prod:assets": "cpx \"app/assets/**/*\" assets",

Built with git-ssb-web