redux-simple-router
Advanced tools
Comparing version 2.0.3 to 2.0.4
## 2.0.3 | ||
## [2.0.4](https://github.com/rackt/redux-simple-router/compare/2.0.2...2.0.4) | ||
This version is just 2.0.2 re-published with a more recent version of npm to fix an issue where the `history` module was being published with the tarball. See [#133](https://github.com/rackt/redux-simple-router/issues/133). | ||
- Remove `history` module published within the tarball. [#133](https://github.com/rackt/redux-simple-router/issues/133) | ||
- Make actions conform to [Flux Standard Action](https://github.com/acdlite/flux-standard-action). [#208](https://github.com/rackt/redux-simple-router/pull/208) | ||
## [2.0.2](https://github.com/jlongster/redux-simple-router/compare/1.0.2...2.0.2) | ||
## [2.0.2](https://github.com/rackt/redux-simple-router/compare/1.0.2...2.0.2) | ||
@@ -18,7 +19,9 @@ Versions 2.0.0 and 2.0.1 were test releases for the 2.* series. 2.0.2 is the first public release. | ||
## [1.0.2](https://github.com/jlongster/redux-simple-router/compare/1.0.1...1.0.2) | ||
[View the new docs](https://github.com/rackt/redux-simple-router#api) | ||
## [1.0.2](https://github.com/rackt/redux-simple-router/compare/1.0.1...1.0.2) | ||
* Only publish relevant files to npm | ||
## [1.0.1](https://github.com/jlongster/redux-simple-router/compare/1.0.0...1.0.1) | ||
## [1.0.1](https://github.com/rackt/redux-simple-router/compare/1.0.0...1.0.1) | ||
@@ -28,3 +31,3 @@ * Solve problem with `basename` causing infinite redirects (#103) | ||
## [1.0.0](https://github.com/jlongster/redux-simple-router/compare/0.0.10...1.0.0) | ||
## [1.0.0](https://github.com/rackt/redux-simple-router/compare/0.0.10...1.0.0) | ||
> 2015-12-09 | ||
@@ -31,0 +34,0 @@ |
@@ -23,3 +23,3 @@ 'use strict'; | ||
type: TRANSITION, | ||
method: method, arg: arg | ||
payload: { method: method, arg: arg } | ||
}; | ||
@@ -40,3 +40,3 @@ }; | ||
type: UPDATE_LOCATION, | ||
location: location | ||
payload: location | ||
}; | ||
@@ -55,3 +55,3 @@ } | ||
var type = _ref.type; | ||
var location = _ref.location; | ||
var location = _ref.payload; | ||
@@ -93,4 +93,5 @@ if (type !== UPDATE_LOCATION) { | ||
var method = action.method; | ||
var arg = action.arg; | ||
var _action$payload = action.payload; | ||
var method = _action$payload.method; | ||
var arg = _action$payload.arg; | ||
@@ -97,0 +98,0 @@ history[method](arg); |
{ | ||
"name": "redux-simple-router", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Ruthlessly simple bindings to keep react-router and redux in sync", | ||
@@ -12,6 +12,3 @@ "main": "lib/index", | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jlongster/redux-simple-router.git" | ||
}, | ||
"repository": "rackt/redux-simple-router", | ||
"authors": [ | ||
@@ -18,0 +15,0 @@ "James Long" |
@@ -19,3 +19,3 @@ # redux-simple-router | ||
View the [CHANGELOG](https://github.com/jlongster/redux-simple-router/blob/master/CHANGELOG.md) for recent changes. | ||
View the [CHANGELOG](https://github.com/rackt/redux-simple-router/blob/master/CHANGELOG.md) for recent changes. | ||
@@ -26,3 +26,3 @@ Read the [API docs](#api) farther down this page. | ||
[redux-router](https://github.com/rackt/redux-router) is another project which solves the same problem. However, it's far more complex. Take a quick look at [the code for this library](https://github.com/jlongster/redux-simple-router/blob/master/src/index.js)—it's extremely minimal. redux-router is much bigger and more complex. | ||
[redux-router](https://github.com/rackt/redux-router) is another project which solves the same problem. However, it's far more complex. Take a quick look at [the code for this library](https://github.com/rackt/redux-simple-router/blob/master/src/index.js)—it's extremely minimal. redux-router is much bigger and more complex. | ||
@@ -39,5 +39,5 @@ That said, redux-router is a fine project and has features this doesn't provide. Use it if you like it better. | ||
The idea of this library is to use react-router's functionality exactly like its documentation tells you to. You can access all of its APIs in routing components. Additionally, you can use redux like you normally would, with a single app state and "connected" components. It's even possible for a single component to be both if needed. | ||
The idea of this library is to use react-router's functionality exactly like its documentation tells you to. You can access all of its APIs in routing components. Additionally, you can use redux like you normally would, with a single app state. | ||
[redux](https://github.com/rackt/redux) (`store.routing`) ↔ [**redux-simple-router**](https://github.com/jlongster/redux-simple-router) ↔ [history](https://github.com/rackt/history) (`history.location`) ↔ [react-router](https://github.com/rackt/react-router) | ||
[redux](https://github.com/rackt/redux) (`store.routing`) ↔ [**redux-simple-router**](https://github.com/rackt/redux-simple-router) ↔ [history](https://github.com/rackt/history) (`history.location`) ↔ [react-router](https://github.com/rackt/react-router) | ||
@@ -55,4 +55,3 @@ We only store current URL and state, whereas redux-router stores the entire location object from react-router. You can read it, and also change it with an action. | ||
import { Provider } from 'react-redux' | ||
import { Router, Route } from 'react-router' | ||
import { createHistory } from 'history' | ||
import { Router, Route, browserHistory } from 'react-router' | ||
import { syncHistory, routeReducer } from 'redux-simple-router' | ||
@@ -64,6 +63,5 @@ import reducers from '<project-path>/reducers' | ||
})) | ||
const history = createHistory() | ||
// Sync dispatched route actions to the history | ||
const reduxRouterMiddleware = syncHistory(history) | ||
const reduxRouterMiddleware = syncHistory(browserHistory) | ||
const createStoreWithMiddleware = applyMiddleware(reduxRouterMiddleware)(createStore) | ||
@@ -78,3 +76,3 @@ | ||
<Provider store={store}> | ||
<Router history={history}> | ||
<Router history={browserHistory}> | ||
<Route path="/" component={App}> | ||
@@ -115,3 +113,3 @@ <Route path="foo" component={Foo}/> | ||
* [examples/basic](https://github.com/jlongster/redux-simple-router/blob/master/examples/basic) - basic reference implementation | ||
* [examples/basic](https://github.com/rackt/redux-simple-router/blob/master/examples/basic) - basic reference implementation | ||
@@ -128,2 +126,3 @@ Examples from the community: | ||
* [StevenIseki/redux-simple-router-example](https://github.com/StevenIseki/redux-simple-router-example) | ||
* [mattkrick/meatier](https://github.com/mattkrick/meatier) - SSR, dual dev/prod client builds | ||
@@ -134,4 +133,2 @@ _Have an example to add? Send us a PR!_ | ||
**This API is for an unreleased version. To view docs for 1.0.2, [click here](https://github.com/rackt/redux-simple-router/tree/1.0.2#api)** | ||
#### `syncHistory(history: History) => ReduxMiddleware` | ||
@@ -149,8 +146,10 @@ | ||
Call this on the middleware returned from `syncHistory` to stop the syncing process set up by `listenForReplays`. | ||
Call this on the middleware returned from `syncHistory` to stop the syncing process set up by `listenForReplays`. | ||
#### `routeReducer` | ||
A reducer function that keeps track of the router state. You must to add this reducer to your app reducers when creating the store. | ||
A reducer function that keeps track of the router state. You must to add this reducer to your app reducers when creating the store. It will return a `location` property in state. If you use `combineReducers`, it will be nested under wherever you property you add it to (`state.routing` in the example above). | ||
**Warning:** It is a bad pattern to use `react-redux`'s `connect` decorator to map the state from this reducer to props on your `Route` components. This can lead to infinite loops and performance problems. `react-router` already provides this for you via `this.props.location`. | ||
#### `UPDATE_LOCATION` | ||
@@ -157,0 +156,0 @@ |
@@ -11,3 +11,3 @@ // Constants | ||
type: TRANSITION, | ||
method, arg | ||
payload: { method, arg } | ||
}) | ||
@@ -27,3 +27,3 @@ } | ||
type: UPDATE_LOCATION, | ||
location | ||
payload: location | ||
} | ||
@@ -38,3 +38,3 @@ } | ||
export function routeReducer(state = initialState, { type, location }) { | ||
export function routeReducer(state = initialState, { type, payload: location }) { | ||
if (type !== UPDATE_LOCATION) { | ||
@@ -71,3 +71,3 @@ return state | ||
const { method, arg } = action | ||
const { payload: { method, arg } } = action | ||
history[method](arg) | ||
@@ -74,0 +74,0 @@ } |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
1
0
1
21212
6
200
1
160
2