Skip to content

Commit 0e9fb90

Browse files
committed
merge conflicts
2 parents fe6a312 + 4db49e3 commit 0e9fb90

File tree

8 files changed

+95
-20
lines changed

8 files changed

+95
-20
lines changed

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
v1.0.0-rc2 - Thu, 08 Oct 2015 05:06:02 GMT
2+
------------------------------------------
3+
4+
- [bdab3d8](../../commit/bdab3d8) [fixed] Compare query by string value
5+
- [c43fb61](../../commit/c43fb61) [added] <Link hash> prop
6+
- [24e7b4f](../../commit/24e7b4f) [fixed] isActive on nested IndexLink
7+
- [160c5ba](../../commit/160c5ba) [fixed] Removed <Link> warning about no history in context
8+
- [ca9e3b7](../../commit/ca9e3b7) [added] IndexRedirect
9+
- [428da54](../../commit/428da54) [added] Support <Redirect to="relative/path">
10+
- [ebb8d20](../../commit/ebb8d20) [fixed] Remove direct calls to createLocation.
11+
- [fc8a7a4](../../commit/fc8a7a4) [changed] Run examples using HTML5 history
12+
- [37d9bac](../../commit/37d9bac) [fixed] isActive on <Link onlyActiveOnIndex>
13+
- [be37196](../../commit/be37196) [fixed] Actually update state when there are transition hooks
14+
- [b8f1abe](../../commit/b8f1abe) [changed] Removed (un)registerRouteHook
15+
- [69a9240](../../commit/69a9240) [fixed] Added missing IndexLink to exports
16+
- [5fbe933](../../commit/5fbe933) [changed] Do not add "active" class by default
17+
- [85c699c](../../commit/85c699c) [changed] State -> IsActive
18+
- [94509e7](../../commit/94509e7) [added] IndexLink
19+
- [adc0a2f](../../commit/adc0a2f) [added] IndexRoute
20+
- [b86509a](../../commit/b86509a) [added] useRoutes history enhancer [added] RoutingContext component [added] RouteContext mixin [added] Lifecycle mixin
21+
- [e72812d](../../commit/e72812d) [added] <Router initialState>
22+
- [4c6dc1b](../../commit/4c6dc1b) [fixed] Installing on Windows
23+
- [042cffc](../../commit/042cffc) [changed] Removed histories/added history dep
24+
- [af7eb55](../../commit/af7eb55) [added] History.onBeforeChange
25+
- [f4ed900](../../commit/f4ed900) [fixed] correctly updates the window scroll position
26+
- [587e54f](../../commit/587e54f) [added] static `history` singleton getter for `HashHistory` and `BrowserHistory`
27+
- [5bd62b5](../../commit/5bd62b5) [fixed] errors in examples
28+
- [4e2ca3c](../../commit/4e2ca3c) [fixed] URI escape path components with special chars
29+
- [0630488](../../commit/0630488) [fixed] Link module adds extra space
30+
- [26400c1](../../commit/26400c1) [fixed] Use encodeURI for splat params
31+
- [178efc3](../../commit/178efc3) [fixed] <Link href> when using HashHistory
32+
- [41bd525](../../commit/41bd525) [fixed] Properly escape splats
33+
- [4759961](../../commit/4759961) [fixed] URLUtils recognize values containing \n
34+
35+
136
v0.13.4 - Tue, 06 Oct 2015 13:13:28 GMT
237
---------------------------------------
338

docs/API.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,14 @@ A `<Link>` also knows when the route it links to is active and automatically app
8585

8686
#### Props
8787
##### `to`
88-
The path to link to, e.g., `/users/123`.
88+
The path to link to, e.g. `/users/123`.
8989

9090
##### `query`
9191
An object of key:value pairs to be stringified.
9292

93+
##### `hash`
94+
A hash to put in the URL, e.g. `#a-hash`.
95+
9396
##### `state`
9497
State to persist to the `location`.
9598

docs/guides/advanced/ServerRendering.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ It looks something like this with an imaginary JavaScript server:
1616
```js
1717
import { renderToString } from 'react-dom/server'
1818
import { match, RoutingContext } from 'react-router'
19+
import createLocation from 'history/lib/createLocation'
1920
import routes from './routes'
2021

2122
serve((req, res) => {
2223
// Note that req.url here should be the full URL path from
2324
// the original request, including the query string.
24-
match({ routes, location: req.url }, (error, redirectLocation, renderProps) => {
25+
const location = createLocation(req.url);
26+
match({ routes, location }, (error, redirectLocation, renderProps) => {
2527
if (error) {
2628
res.send(500, error.message)
2729
} else if (redirectLocation) {

modules/Link.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ class Link extends React.Component {
4343
}
4444

4545
static propTypes = {
46-
activeStyle: object,
47-
activeClassName: string,
48-
onlyActiveOnIndex: bool.isRequired,
4946
to: string.isRequired,
5047
query: object,
48+
hash: string,
5149
state: object,
50+
activeStyle: object,
51+
activeClassName: string,
52+
onlyActiveOnIndex: bool.isRequired,
5253
onClick: func
5354
}
5455

@@ -77,16 +78,19 @@ class Link extends React.Component {
7778
}
7879

7980
render() {
80-
const { history } = this.context
81-
const { activeClassName, activeStyle, onlyActiveOnIndex, to, query, state, onClick, ...props } = this.props
81+
const { to, query, hash, state, activeClassName, activeStyle, onlyActiveOnIndex, ...props } = this.props
8282

83+
// Manually override onClick.
8384
props.onClick = (e) => this.handleClick(e)
8485

85-
// Ignore if rendered outside the context
86-
// of history, simplifies unit testing.
86+
// Ignore if rendered outside the context of history, simplifies unit testing.
87+
const { history } = this.context
8788
if (history) {
8889
props.href = history.createHref(to, query)
8990

91+
if (hash)
92+
props.href += hash
93+
9094
if (activeClassName || (activeStyle != null && !isEmptyObject(activeStyle))) {
9195
if (history.isActive(to, query, onlyActiveOnIndex)) {
9296
if (activeClassName)

modules/__tests__/Link-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('A <Link>', function () {
3535
it('knows how to make its href', function () {
3636
class LinkWrapper extends React.Component {
3737
render() {
38-
return <Link to="/hello/michael" query={{ the: 'query' }}>Link</Link>
38+
return <Link to="/hello/michael" query={{ the: 'query' }} hash="#the-hash">Link</Link>
3939
}
4040
}
4141

@@ -45,7 +45,7 @@ describe('A <Link>', function () {
4545
</Router>
4646
), node, function () {
4747
const a = node.querySelector('a')
48-
expect(a.getAttribute('href')).toEqual('/hello/michael?the=query')
48+
expect(a.getAttribute('href')).toEqual('/hello/michael?the=query#the-hash')
4949
})
5050
})
5151

modules/__tests__/isActive-test.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('isActive', function () {
2323
describe('with no query', function () {
2424
it('is active', function (done) {
2525
render((
26-
<Router history={createHistory('/home')}>
26+
<Router history={createHistory('/home?the=query')}>
2727
<Route path="/home" />
2828
</Router>
2929
), node, function () {
@@ -46,6 +46,19 @@ describe('isActive', function () {
4646
})
4747
})
4848

49+
describe('with a query that also matches by value, but not by type', function () {
50+
it('is active', function (done) {
51+
render((
52+
<Router history={createHistory('/home?the=query&n=2&show=false')}>
53+
<Route path="/home" />
54+
</Router>
55+
), node, function () {
56+
expect(this.history.isActive('/home', { the: 'query', n: 2, show: false })).toBe(true)
57+
done()
58+
})
59+
})
60+
})
61+
4962
describe('with a query that does not match', function () {
5063
it('is not active', function (done) {
5164
render((

modules/isActive.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
import { matchPattern } from './PatternUtils'
2-
import deepEqual from 'deep-equal'
2+
3+
function deepEqual(a, b) {
4+
if (a == b)
5+
return true
6+
7+
if (a == null || b == null)
8+
return false
9+
10+
if (Array.isArray(a)) {
11+
return Array.isArray(b) && a.length === b.length && a.every(function (item, index) {
12+
return deepEqual(item, b[index])
13+
})
14+
}
15+
16+
if (typeof a === 'object') {
17+
for (let p in a)
18+
if (a.hasOwnProperty(p) && (!b.hasOwnProperty(p) || !deepEqual(a[p], b[p])))
19+
return false
20+
21+
return true
22+
}
23+
24+
return String(a) === String(b)
25+
}
326

427
function paramsAreActive(paramNames, paramValues, activeParams) {
528
return paramNames.every(function (paramName, index) {
@@ -11,10 +34,6 @@ function getMatchingRoute(pathname, activeRoutes, activeParams) {
1134
let route, pattern, basename = ''
1235
for (let i = 0, len = activeRoutes.length; i < len; ++i) {
1336
route = activeRoutes[i]
14-
15-
//if (!route.path)
16-
// return false
17-
1837
pattern = route.path || ''
1938

2039
if (pattern.charAt(0) !== '/')

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router",
3-
"version": "1.0.0-rc1",
3+
"version": "1.0.0-rc2",
44
"description": "A complete routing library for React.js",
55
"main": "lib/index",
66
"repository": {
@@ -25,7 +25,6 @@
2525
],
2626
"license": "MIT",
2727
"dependencies": {
28-
"deep-equal": "^1.0.0",
2928
"history": "1.12.1",
3029
"invariant": "^2.0.0",
3130
"warning": "^2.0.0"
@@ -54,7 +53,7 @@
5453
"mocha": "^2.0.1",
5554
"qs": "^4.0.0",
5655
"react": "0.14.0",
57-
"react-addons-test-utils": "^0.14.0",
56+
"react-addons-test-utils": "0.14.0",
5857
"react-dom": "0.14.0",
5958
"rf-changelog": "^0.4.0",
6059
"style-loader": "^0.12.4",

0 commit comments

Comments
 (0)