Skip to content
This repository was archived by the owner on Oct 26, 2018. It is now read-only.

Split history syncing from action creators #259

Merged
merged 38 commits into from
Feb 17, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7cdc72a
Extract the action creators and middleware.
timdorr Feb 5, 2016
2946938
Pull in @gaearon's history syncer.
timdorr Feb 5, 2016
21b511b
Go with Babel Stage 1 for export extensions.
timdorr Feb 5, 2016
fbe174f
Update the example against the new API.
timdorr Feb 5, 2016
88bc0de
Minor reorg. Split the reducer to its own file.
timdorr Feb 5, 2016
a2ec57b
Fix linting in example.
timdorr Feb 5, 2016
36845f5
Hollow out the old tests and fill in something basic.
timdorr Feb 5, 2016
10e34d2
Update build script for multi-file setup.
timdorr Feb 5, 2016
4c17b0e
Clean up some testing framework stuff.
timdorr Feb 5, 2016
c61c92c
Use spread instead Object.assign. Following #259
webmasterkai Feb 6, 2016
4afd74f
Confirm location change before listener invokation
webmasterkai Feb 6, 2016
fc12f70
Begin updating example in README. Re #259
webmasterkai Feb 6, 2016
1a8c800
README syncHistory becomes syncHistoryWithStore
webmasterkai Feb 6, 2016
08b3818
Merge pull request #262 from webmasterkai/synchronicity
timdorr Feb 6, 2016
379dc9c
Add back route action tests.
timdorr Feb 6, 2016
def06ff
Add reducer tests. Ensure actions are FSA.
timdorr Feb 6, 2016
2b177f5
Add middleware test. Reorg test suite.
timdorr Feb 6, 2016
2c88667
rename UPDATE_LOCATION to CALL_HISTORY_METHOD
webmasterkai Feb 6, 2016
a452791
Merge pull request #265 from webmasterkai/actionTypeAlt
timdorr Feb 6, 2016
cb9d6b6
Redone docs.
timdorr Feb 7, 2016
50faa62
Add a note warning about reading from store.
timdorr Feb 7, 2016
4308208
Add back some other relevant tests.
timdorr Feb 7, 2016
0b7b322
Add docs for syncHistoryWithStore's options.
timdorr Feb 8, 2016
9b2dc36
Don't leave test side effects with history singltons.
timdorr Feb 8, 2016
820f46e
4.0.0-beta.1
timdorr Feb 8, 2016
8ed23ca
Merge remote-tracking branch 'origin/master' into synchronicity
timdorr Feb 10, 2016
98ceca0
Merge remote-tracking branch 'origin/master' into synchronicity
timdorr Feb 12, 2016
f0e09db
docs(readme): add example migration from ^3.0.0
Feb 12, 2016
d54496c
Merge pull request #271 from davezuko/patch-2
timdorr Feb 12, 2016
d45f1c6
Update README.md
justin808 Feb 14, 2016
60fa049
Merge pull request #278 from justin808/patch-2
timdorr Feb 14, 2016
8bc27b9
Merge remote-tracking branch 'origin/master' into synchronicity
timdorr Feb 15, 2016
cdc941d
Switch to run example on webpack-dev-server.
timdorr Feb 15, 2016
31b3809
added example to readme
svrcekmichal Feb 15, 2016
d2e5173
Merge pull request #280 from svrcekmichal/synchronicity
timdorr Feb 15, 2016
67aefaa
Merge remote-tracking branch 'origin/master' into synchronicity
timdorr Feb 15, 2016
87402ea
Add a SSR example.
timdorr Feb 17, 2016
8d4750e
Merge remote-tracking branch 'origin/master' into synchronicity
timdorr Feb 17, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update the example against the new API.
Not that bad. In fact, it's mostly stuff removed! :)
  • Loading branch information
timdorr committed Feb 5, 2016
commit fbe174f0ddd94f8adcfca471fd6c51ceb8aafdc0
18 changes: 7 additions & 11 deletions examples/basic/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ import React from 'react'
import ReactDOM from 'react-dom'
import { applyMiddleware, compose, createStore, combineReducers } from 'redux'
import { Provider } from 'react-redux'
import { Router, Route, IndexRoute } from 'react-router'
import createHistory from 'history/lib/createHashHistory'
import { syncHistory, routeReducer } from 'react-router-redux'
import { Router, Route, IndexRoute, hashHistory } from 'react-router'
import { syncHistoryWithStore, routerReducer } from 'react-router-redux'

import * as reducers from './reducers'
import { App, Home, Foo, Bar } from './components'

const history = createHistory()
const middleware = syncHistory(history)
const reducer = combineReducers({
...reducers,
routing: routeReducer
routing: routerReducer
})

const DevTools = createDevTools(
Expand All @@ -27,12 +24,11 @@ const DevTools = createDevTools(
</DockMonitor>
)

const finalCreateStore = compose(
applyMiddleware(middleware),
const store = createStore(
reducer,
DevTools.instrument()
)(createStore)
const store = finalCreateStore(reducer)
middleware.listenForReplays(store)
)
const history = syncHistoryWithStore(hashHistory, store)

ReactDOM.render(
<Provider store={store}>
Expand Down
13 changes: 3 additions & 10 deletions examples/basic/components/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react'
import { Link } from 'react-router'
import { connect } from 'react-redux'
import { routeActions } from 'react-router-redux'
import { Link, hashHistory } from 'react-router'

function App({ push, children }) {
export default function App({ children }) {
return (
<div>
<header>
Expand All @@ -16,14 +14,9 @@ function App({ push, children }) {
<Link to="/bar">Bar</Link>
</header>
<div>
<button onClick={() => push('/foo')}>Go to /foo</button>
<button onClick={() => hashHistory.push('/foo')}>Go to /foo</button>
</div>
<div style={{ marginTop: '1.5em' }}>{children}</div>
</div>
)
}

export default connect(
null,
routeActions
)(App)
31 changes: 15 additions & 16 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@
"repository": "rackt/react-router-redux",
"license": "MIT",
"dependencies": {
"history": "^1.14.0",
"react": "^0.14.2",
"react-dom": "^0.14.2",
"react-redux": "^4.0.0",
"react-router": "^1.0.0",
"redux": "^3.0.4",
"react-router-redux": "^2.1.0"
"react": "^0.14.7",
"react-dom": "^0.14.7",
"react-redux": "^4.3.0",
"react-router": "^2.0.0-rc5",
"redux": "^3.2.1",
"react-router-redux": "^3.0.0"
},
"devDependencies": {
"babel-core": "^6.1.21",
"babel-eslint": "^5.0.0-beta6",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"babel-core": "^6.4.5",
"babel-eslint": "^5.0.0-beta9",
"babel-loader": "^6.2.2",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-1": "^6.3.13",
"eslint": "^1.10.3",
"eslint-config-rackt": "^1.1.1",
"eslint-plugin-react": "^3.15.0",
"redux-devtools": "^3.0.0",
"eslint-plugin-react": "^3.16.1",
"redux-devtools": "^3.1.0",
"redux-devtools-dock-monitor": "^1.0.1",
"redux-devtools-log-monitor": "^1.0.1",
"webpack": "^1.12.6"
"redux-devtools-log-monitor": "^1.0.4",
"webpack": "^1.12.13"
},
"scripts": {
"start": "webpack --watch"
Expand Down