Skip to content

Commit 6996451

Browse files
committed
release v0.11.6
1 parent 90cd750 commit 6996451

File tree

5 files changed

+52
-41
lines changed

5 files changed

+52
-41
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v0.11.6 - Wed, 17 Dec 2014 19:29:53 GMT
2+
---------------------------------------
3+
4+
- [90cd750](../../commit/90cd750) [fixed] Call all transition hooks on query changes
5+
6+
17
v0.11.5 - Mon, 15 Dec 2014 22:32:38 GMT
28
---------------------------------------
39

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router",
3-
"version": "0.11.5",
3+
"version": "0.11.6",
44
"homepage": "https://github.com/rackt/react-router",
55
"authors": [
66
"Ryan Florence",

dist/react-router.js

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,7 @@ var HistoryLocation = {
578578
notifyChange(LocationActions.REPLACE);
579579
},
580580

581-
pop: function () {
582-
History.back();
583-
},
581+
pop: History.back,
584582

585583
getCurrentPath: getWindowPath,
586584

@@ -1071,7 +1069,7 @@ var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM;
10711069
var History = {
10721070

10731071
/**
1074-
* Sends the browser back one entry in the history, if one is available.
1072+
* Sends the browser back one entry in the history.
10751073
*/
10761074
back: function () {
10771075
invariant(
@@ -1443,7 +1441,6 @@ module.exports = Transition;
14431441

14441442
},{"./Promise":24,"./Redirect":26,"./reversedArray":31,"react/lib/Object.assign":40}],28:[function(_dereq_,module,exports){
14451443
/* jshint -W058 */
1446-
14471444
var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
14481445
var warning = _dereq_('react/lib/warning');
14491446
var invariant = _dereq_('react/lib/invariant');
@@ -1536,22 +1533,32 @@ function createMatch(route, params) {
15361533
return { routes: [ route ], params: params };
15371534
}
15381535

1539-
function hasMatch(routes, route, prevParams, nextParams) {
1536+
function hasProperties(object, properties) {
1537+
for (var propertyName in properties)
1538+
if (properties.hasOwnProperty(propertyName) && object[propertyName] !== properties[propertyName])
1539+
return false;
1540+
1541+
return true;
1542+
}
1543+
1544+
function hasMatch(routes, route, prevParams, nextParams, prevQuery, nextQuery) {
15401545
return routes.some(function (r) {
15411546
if (r !== route)
15421547
return false;
15431548

15441549
var paramNames = route.paramNames;
15451550
var paramName;
15461551

1552+
// Ensure that all params the route cares about did not change.
15471553
for (var i = 0, len = paramNames.length; i < len; ++i) {
15481554
paramName = paramNames[i];
15491555

15501556
if (nextParams[paramName] !== prevParams[paramName])
15511557
return false;
15521558
}
15531559

1554-
return true;
1560+
// Ensure the query hasn't changed.
1561+
return hasProperties(prevQuery, nextQuery) && hasProperties(nextQuery, prevQuery);
15551562
});
15561563
}
15571564

@@ -1598,6 +1605,20 @@ function createRouter(options) {
15981605
nextState = {};
15991606
}
16001607

1608+
if (typeof location === 'string') {
1609+
warning(
1610+
!canUseDOM || "production" === 'test',
1611+
'You should not use a static location in a DOM environment because ' +
1612+
'the router will not be kept in sync with the current URL'
1613+
);
1614+
} else {
1615+
invariant(
1616+
canUseDOM,
1617+
'You cannot use %s without a DOM',
1618+
location
1619+
);
1620+
}
1621+
16011622
// Automatically fall back to full page refreshes in
16021623
// browsers that don't support the HTML history API.
16031624
if (location === HistoryLocation && !supportsHistory())
@@ -1687,16 +1708,23 @@ function createRouter(options) {
16871708
},
16881709

16891710
/**
1690-
* Transitions to the previous URL. Returns true if the router
1691-
* was able to go back, false otherwise.
1711+
* Transitions to the previous URL if one is available. Returns true if the
1712+
* router was able to go back, false otherwise.
1713+
*
1714+
* Note: The router only tracks history entries in your application, not the
1715+
* current browser session, so you can safely call this function without guarding
1716+
* against sending the user back to some other site. However, when using
1717+
* RefreshLocation (which is the fallback for HistoryLocation in browsers that
1718+
* don't support HTML5 history) this method will *always* send the client back
1719+
* because we cannot reliably track history length.
16921720
*/
16931721
goBack: function () {
16941722
invariant(
16951723
typeof location !== 'string',
16961724
'You cannot use goBack with a static location'
16971725
);
16981726

1699-
if (History.length > 1) {
1727+
if (History.length > 1 || location === RefreshLocation) {
17001728
location.pop();
17011729
return true;
17021730
}
@@ -1759,6 +1787,7 @@ function createRouter(options) {
17591787

17601788
var prevRoutes = state.routes || [];
17611789
var prevParams = state.params || {};
1790+
var prevQuery = state.query || {};
17621791

17631792
var nextRoutes = match.routes || [];
17641793
var nextParams = match.params || {};
@@ -1767,27 +1796,17 @@ function createRouter(options) {
17671796
var fromRoutes, toRoutes;
17681797
if (prevRoutes.length) {
17691798
fromRoutes = prevRoutes.filter(function (route) {
1770-
return !hasMatch(nextRoutes, route, prevParams, nextParams);
1799+
return !hasMatch(nextRoutes, route, prevParams, nextParams, prevQuery, nextQuery);
17711800
});
17721801

17731802
toRoutes = nextRoutes.filter(function (route) {
1774-
return !hasMatch(prevRoutes, route, prevParams, nextParams);
1803+
return !hasMatch(prevRoutes, route, prevParams, nextParams, prevQuery, nextQuery);
17751804
});
17761805
} else {
17771806
fromRoutes = [];
17781807
toRoutes = nextRoutes;
17791808
}
17801809

1781-
// If routes' hooks arrays are empty, then we transition to current route.
1782-
// But path is somehow still get changed.
1783-
// That could be only because of route query changes.
1784-
// Need to push current route to routes' hooks arrays.
1785-
if (!toRoutes.length && !fromRoutes.length) {
1786-
var currentRoute = state.routes[state.routes.length-1];
1787-
fromRoutes = [currentRoute];
1788-
toRoutes = [currentRoute];
1789-
}
1790-
17911810
var transition = new Transition(path, this.replaceWith.bind(this, path));
17921811
pendingTransition = transition;
17931812

@@ -1832,21 +1851,8 @@ function createRouter(options) {
18321851
};
18331852

18341853
if (typeof location === 'string') {
1835-
warning(
1836-
!canUseDOM || "production" === 'test',
1837-
'You should not use a static location in a DOM environment because ' +
1838-
'the router will not be kept in sync with the current URL'
1839-
);
1840-
1841-
// Dispatch the location.
18421854
router.dispatch(location, null, dispatchHandler);
18431855
} else {
1844-
invariant(
1845-
canUseDOM,
1846-
'You cannot use %s in a non-DOM environment',
1847-
location
1848-
);
1849-
18501856
// Listen for changes to the location.
18511857
var changeListener = function (change) {
18521858
router.dispatch(change.path, change.type, dispatchHandler);
@@ -1931,7 +1937,6 @@ module.exports = createRouter;
19311937

19321938
},{"../actions/LocationActions":1,"../behaviors/ImitateBrowserBehavior":2,"../components/RouteHandler":9,"../locations/HashLocation":11,"../locations/HistoryLocation":12,"../locations/RefreshLocation":13,"../mixins/NavigationContext":16,"../mixins/Scrolling":18,"../mixins/StateContext":20,"./Cancellation":21,"./History":22,"./Path":23,"./PropTypes":25,"./Redirect":26,"./Transition":27,"./createRoutesFromChildren":29,"./supportsHistory":33,"react/lib/ExecutionEnvironment":39,"react/lib/invariant":43,"react/lib/warning":44}],29:[function(_dereq_,module,exports){
19331939
/* jshint -W084 */
1934-
19351940
var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
19361941
var warning = _dereq_('react/lib/warning');
19371942
var invariant = _dereq_('react/lib/invariant');
@@ -2818,7 +2823,7 @@ var emptyFunction = _dereq_("./emptyFunction");
28182823
var warning = emptyFunction;
28192824

28202825
if ("production" !== "production") {
2821-
warning = function(condition, format ) {var args=Array.prototype.slice.call(arguments,2);
2826+
warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
28222827
if (format === undefined) {
28232828
throw new Error(
28242829
'`warning(condition, format, ...args)` requires a warning ' +

dist/react-router.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router",
3-
"version": "0.11.5",
3+
"version": "0.11.6",
44
"description": "A complete routing library for React.js",
55
"main": "./modules/index",
66
"repository": {

0 commit comments

Comments
 (0)