Skip to content

Commit 1c72f23

Browse files
committed
Merge branch 'master' into next
2 parents 08d0057 + d782f5c commit 1c72f23

30 files changed

+192
-175
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ before_install:
1010
- export DISPLAY=:99.0
1111
- sh -e /etc/init.d/xvfb start
1212
after_success:
13-
- cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
14-
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
13+
- node_modules/.bin/codecov
1514
branches:
1615
only:
1716
- master

CHANGES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828
[#3446]: https://github.com/reactjs/react-router/pull/3446
2929

3030

31+
## [v2.6.1]
32+
> Jul 29, 2016
33+
34+
- **Bugfix:** Correctly handle routes with patterns that are the names of properties on `Object.prototype` ([#3680])
35+
36+
[v2.6.1]: https://github.com/reactjs/react-router/compare/v2.6.0...v2.6.1
37+
[#3680]: https://github.com/reactjs/react-router/pull/3680
38+
39+
3140
## [v2.6.0]
3241
> Jul 18, 2016
3342

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ React Router is a complete routing library for [React](https://facebook.github.i
66

77
React Router keeps your UI in sync with the URL. It has a simple API with powerful features like lazy code loading, dynamic route matching, and location transition handling built right in. Make the URL your first thought, not an after-thought.
88

9-
[![Coveralls][coveralls-badge]][coveralls]
9+
[![Codecov][codecov-badge]][codecov]
1010
[![Discord][discord-badge]][discord]
1111

1212
> **Important:** *This is the `next` branch of React Router and may contain changes that are not yet released. To see the code for stable releases, browse [the `master` branch](https://github.com/reactjs/react-router/tree/master).*
@@ -39,7 +39,7 @@ Using [npm](https://www.npmjs.com/):
3939

4040
Then with a module bundler like [webpack](https://webpack.github.io/) that supports either CommonJS or ES2015 modules, use as you would anything else:
4141

42-
```js
42+
```jsx
4343
// using an ES6 transpiler, like babel
4444
import { Router, Route, Link } from 'react-router'
4545

@@ -59,7 +59,7 @@ You can find the library on `window.ReactRouter`.
5959

6060
### What's it look like?
6161

62-
```js
62+
```jsx
6363
import React from 'react'
6464
import { render } from 'react-dom'
6565
import { Router, Route, Link, browserHistory } from 'react-router'
@@ -144,8 +144,8 @@ Also, thanks to [BrowserStack](https://www.browserstack.com/) for providing the
144144
[npm-badge]: https://img.shields.io/npm/v/react-router.svg?style=flat-square
145145
[npm]: https://www.npmjs.org/package/react-router
146146

147-
[coveralls-badge]: https://img.shields.io/coveralls/reactjs/react-router/master.svg?style=flat-square
148-
[coveralls]: https://coveralls.io/github/reactjs/react-router
147+
[codecov-badge]: https://img.shields.io/codecov/c/github/reactjs/react-router/master.svg?style=flat-square
148+
[codecov]: https://codecov.io/gh/reactjs/react-router
149149

150150
[discord-badge]: https://img.shields.io/badge/Discord-join%20chat%20%E2%86%92-738bd7.svg?style=flat-square
151151
[discord]: https://discord.gg/0ZcbPKXt5bYaNQ46

codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comment: false

docs/API.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ Alias for `children`.
4646
##### `history`
4747
The history the router should listen to. Typically `browserHistory` or `hashHistory`.
4848

49-
```js
49+
```jsx
5050
import { browserHistory } from 'react-router'
5151
ReactDOM.render(<Router history={browserHistory} />, el)
5252
```
5353

5454
##### `createElement(Component, props)`
5555
When the router is ready to render a branch of route components, it will use this function to create the elements. You may want to take control of creating the elements when you're using some sort of data abstraction, like setting up subscriptions to stores, or passing in some sort of application module to each component via props.
5656

57-
```js
57+
```jsx
5858
<Router createElement={createElement} />
5959

6060
// default behavior
@@ -123,7 +123,7 @@ You can also pass props you'd like to be on the `<a>` such as a `title`, `id`, `
123123
#### Example
124124
Given a route like `<Route path="/users/:userId" />`:
125125

126-
```js
126+
```jsx
127127
<Link to={`/users/${user.id}`} activeClassName="active">{user.name}</Link>
128128
// becomes one of these depending on your History and if the route is
129129
// active
@@ -155,7 +155,7 @@ Contains data and methods relevant to routing. Most useful for imperatively tran
155155
##### `push(pathOrLoc)`
156156
Transitions to a new URL, adding a new entry in the browser history.
157157

158-
```js
158+
```jsx
159159
router.push('/users/12')
160160

161161
// or with a location descriptor object
@@ -225,7 +225,7 @@ If left undefined, the router will try to match the child routes.
225225
A single component to be rendered when the route matches the URL. It can
226226
be rendered by the parent route component with `this.props.children`.
227227

228-
```js
228+
```jsx
229229
const routes = (
230230
<Route component={App}>
231231
<Route path="groups" component={Groups} />
@@ -248,7 +248,7 @@ class App extends React.Component {
248248
##### `components`
249249
Routes can define one or more named components as an object of `[name]: component` pairs to be rendered when the path matches the URL. They can be rendered by the parent route component with `this.props[name]`.
250250

251-
```js
251+
```jsx
252252
// Think of it outside the context of the router - if you had pluggable
253253
// portions of your `render`, you might do it like this:
254254
// <App main={<Users />} sidebar={<UsersSidebar />} />
@@ -299,7 +299,7 @@ Same as `component` but asynchronous, useful for code-splitting.
299299
###### `callback` signature
300300
`cb(err, component)`
301301

302-
```js
302+
```jsx
303303
<Route path="courses/:courseId" getComponent={(nextState, cb) => {
304304
// do asynchronous stuff to find the components
305305
cb(null, Course)
@@ -313,7 +313,7 @@ code-splitting.
313313
###### `callback` signature
314314
`cb(err, components)`
315315

316-
```js
316+
```jsx
317317
<Route path="courses/:courseId" getComponents={(nextState, cb) => {
318318
// do asynchronous stuff to find the components
319319
cb(null, {sidebar: CourseSidebar, content: Course})
@@ -331,7 +331,7 @@ If `callback` is listed as a 3rd argument, this hook will run asynchronously, an
331331
###### `callback` signature
332332
`cb(err)`
333333

334-
```js
334+
```jsx
335335
const userIsInATeam = (nextState, replace, callback) => {
336336
fetch(...)
337337
.then(response = response.json())
@@ -372,7 +372,7 @@ Same as `childRoutes` but asynchronous and receives `partialNextState`. Useful f
372372
###### `callback` signature
373373
`cb(err, routesArray)`
374374

375-
```js
375+
```jsx
376376
let myRoute = {
377377
path: 'course/:courseId',
378378
childRoutes: [
@@ -419,7 +419,7 @@ Same as `indexRoute`, but asynchronous and receives `partialNextState`. As with
419419
###### `callback` signature
420420
`cb(err, route)`
421421

422-
```js
422+
```jsx
423423
// For example:
424424
let myIndexRoute = {
425425
component: MyIndex
@@ -455,7 +455,7 @@ The path you want to redirect to.
455455
##### `query`
456456
By default, the query parameters will just pass through but you can specify them if you need to.
457457

458-
```js
458+
```jsx
459459
// Say we want to change from `/profile/123` to `/about/123`
460460
// and redirect `/get-in-touch` to `/contact`
461461
<Route component={App}>
@@ -467,7 +467,7 @@ By default, the query parameters will just pass through but you can specify them
467467

468468
Note that the `<Redirect>` can be placed anywhere in the route hierarchy, though [normal precedence](/docs/guides/RouteMatching.md#precedence) rules apply. If you'd prefer the redirects to be next to their respective routes, the `from` path will match the same as a regular route `path`.
469469

470-
```js
470+
```jsx
471471
<Route path="course/:courseId">
472472
<Route path="dashboard" />
473473
{/* /course/123/home -> /course/123/dashboard */}
@@ -521,7 +521,7 @@ A subset of `this.props.params` that were directly specified in this component's
521521
The matched child route element to be rendered. If the route has [named components](/docs/API.md#named-components) then this will be undefined, and the components will instead be available as direct properties on `this.props`.
522522

523523
##### Example
524-
```js
524+
```jsx
525525
render((
526526
<Router>
527527
<Route path="/" component={App}>
@@ -547,7 +547,7 @@ class App extends React.Component {
547547
When a route has one or more named components, the child elements are available by name on `this.props`. In this case `this.props.children` will be undefined. All route components can participate in the nesting.
548548

549549
#### Example
550-
```js
550+
```jsx
551551
render((
552552
<Router>
553553
<Route path="/" component={App}>
@@ -619,7 +619,7 @@ and
619619
enhancers from `history`
620620

621621
#### Example
622-
```js
622+
```jsx
623623
import createHashHistory from 'history/lib/createHashHistory'
624624
const history = useRouterHistory(createHashHistory)({ queryKey: false })
625625
```

docs/Glossary.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This is a glossary of common terms used in the React Router codebase and documen
2727

2828
## Action
2929

30-
```js
30+
```jsx
3131
type Action = 'PUSH' | 'REPLACE' | 'POP';
3232
```
3333

@@ -39,15 +39,15 @@ An *action* describes the type of change to a URL. Possible values are:
3939

4040
## Component
4141

42-
```js
42+
```jsx
4343
type Component = ReactClass | string;
4444
```
4545

4646
A *component* is a React component class or a string (e.g. "div"). Basically, it's anything that can be used as the first argument to [`React.createElement`](https://facebook.github.io/react/docs/top-level-api.html#react.createelement).
4747

4848
## EnterHook
4949

50-
```js
50+
```jsx
5151
type EnterHook = (nextState: RouterState, replace: RedirectFunction, callback?: Function) => any;
5252
```
5353

@@ -65,15 +65,15 @@ A *hash* is a string that represents the hash portion of the URL. It is synonymo
6565

6666
## LeaveHook
6767

68-
```js
68+
```jsx
6969
type LeaveHook = (prevState: RouterState) => any;
7070
```
7171

7272
A *leave hook* is a user-defined function that is called when a route is about to be unmounted. It receives the previous [router state](#routerstate) as its first argument.
7373

7474
## Location
7575

76-
```js
76+
```jsx
7777
type Location = {
7878
pathname: Pathname;
7979
search: QueryString;
@@ -108,15 +108,15 @@ You can read more about location descriptors in [the `history` docs](https://git
108108

109109
## LocationKey
110110

111-
```js
111+
```jsx
112112
type LocationKey = string;
113113
```
114114

115115
A *location key* is a string that is unique to a particular [`location`](#location). It is the one piece of data that most accurately answers the question "Where am I?".
116116

117117
## LocationState
118118

119-
```js
119+
```jsx
120120
type LocationState = ?Object;
121121
```
122122
@@ -129,55 +129,55 @@ This type gets its name from the first argument to HTML5's [`pushState`][pushSta
129129
130130
## Params
131131
132-
```js
132+
```jsx
133133
type Params = Object;
134134
```
135135
136136
The word *params* refers to an object of key/value pairs that were parsed out of the original URL's [pathname](#pathname). The values of this object are typically strings, unless there is more than one param with the same name in which case the value is an array.
137137
138138
## Path
139139
140-
```js
140+
```jsx
141141
type Path = Pathname + QueryString + Hash;
142142
```
143143
144144
A *path* represents a URL path.
145145
146146
## Pathname
147147
148-
```js
148+
```jsx
149149
type Pathname = string;
150150
```
151151
152152
A *pathname* is the portion of a URL that describes a hierarchical path, including the preceding `/`. For example, in `http://example.com/the/path?the=query`, `/the/path` is the pathname. It is synonymous with `window.location.pathname` in web browsers.
153153

154154
## Query
155155

156-
```js
156+
```jsx
157157
type Query = Object;
158158
```
159159

160160
A *query* is the parsed version of a [query string](#querystring).
161161

162162
## QueryString
163163

164-
```js
164+
```jsx
165165
type QueryString = string;
166166
```
167167

168168
A *query string* is the portion of the URL that follows the [pathname](#pathname), including any preceding `?`. For example, in `http://example.com/the/path?the=query`, `?the=query` is the query string. It is synonymous with `window.location.search` in web browsers.
169169

170170
## RedirectFunction
171171

172-
```js
172+
```jsx
173173
type RedirectFunction = (state: ?LocationState, pathname: Pathname | Path, query: ?Query) => void;
174174
```
175175

176176
A *redirect function* is used in [`onEnter` hooks](#enterhook) to trigger a transition to a new URL.
177177

178178
## Route
179179

180-
```js
180+
```jsx
181181
type Route = {
182182
component: RouteComponent;
183183
path: ?RoutePattern;
@@ -192,7 +192,7 @@ It may help to think of a route as an "entry point" into your UI. You don't need
192192
193193
## RouteComponent
194194
195-
```js
195+
```jsx
196196
type RouteComponent = Component;
197197
```
198198
@@ -208,23 +208,23 @@ Route components should generally be component classes rather than strings. This
208208
209209
## RouteConfig
210210
211-
```js
211+
```jsx
212212
type RouteConfig = Array<Route>;
213213
```
214214
215215
A *route config* is an array of [route](#route)s that specifies the order in which routes should be tried when the router attempts to match a URL.
216216
217217
## RouteHook
218218
219-
```js
219+
```jsx
220220
type RouteHook = (nextLocation?: Location) => any;
221221
```
222222
223223
A *route hook* is a function that is used to prevent the user from leaving a route. On normal transitions, it receives the next [location](#location) as an argument and must either `return false` to cancel the transition or `return` a prompt message to show the user. When invoked during the `beforeunload` event in web browsers, it does not receive any arguments and must `return` a prompt message to cancel the transition.
224224
225225
## RoutePattern
226226
227-
```js
227+
```jsx
228228
type RoutePattern = string;
229229
```
230230
@@ -239,7 +239,7 @@ Route patterns are relative to the pattern of the parent route unless they begin
239239
240240
## Router
241241
242-
```js
242+
```jsx
243243
type Router = {
244244
push(location: LocationDescriptor) => void;
245245
replace(location: LocationDescriptor) => void;
@@ -255,7 +255,7 @@ A *router* object allows for procedural manipulation of the routing state.
255255
256256
## RouterState
257257
258-
```js
258+
```jsx
259259
type RouterState = {
260260
location: Location;
261261
routes: Array<Route>;

0 commit comments

Comments
 (0)