Skip to content

Commit

Permalink
release v0.11.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Dec 17, 2014
1 parent 90cd750 commit 6996451
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 41 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v0.11.6 - Wed, 17 Dec 2014 19:29:53 GMT
---------------------------------------

- [90cd750](../../commit/90cd750) [fixed] Call all transition hooks on query changes


v0.11.5 - Mon, 15 Dec 2014 22:32:38 GMT
---------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router",
"version": "0.11.5",
"version": "0.11.6",
"homepage": "https://github.com/rackt/react-router",
"authors": [
"Ryan Florence",
Expand Down
79 changes: 42 additions & 37 deletions dist/react-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,7 @@ var HistoryLocation = {
notifyChange(LocationActions.REPLACE);
},

pop: function () {
History.back();
},
pop: History.back,

getCurrentPath: getWindowPath,

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

/**
* Sends the browser back one entry in the history, if one is available.
* Sends the browser back one entry in the history.
*/
back: function () {
invariant(
Expand Down Expand Up @@ -1443,7 +1441,6 @@ module.exports = Transition;

},{"./Promise":24,"./Redirect":26,"./reversedArray":31,"react/lib/Object.assign":40}],28:[function(_dereq_,module,exports){
/* jshint -W058 */

var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
var warning = _dereq_('react/lib/warning');
var invariant = _dereq_('react/lib/invariant');
Expand Down Expand Up @@ -1536,22 +1533,32 @@ function createMatch(route, params) {
return { routes: [ route ], params: params };
}

function hasMatch(routes, route, prevParams, nextParams) {
function hasProperties(object, properties) {
for (var propertyName in properties)
if (properties.hasOwnProperty(propertyName) && object[propertyName] !== properties[propertyName])
return false;

return true;
}

function hasMatch(routes, route, prevParams, nextParams, prevQuery, nextQuery) {
return routes.some(function (r) {
if (r !== route)
return false;

var paramNames = route.paramNames;
var paramName;

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

if (nextParams[paramName] !== prevParams[paramName])
return false;
}

return true;
// Ensure the query hasn't changed.
return hasProperties(prevQuery, nextQuery) && hasProperties(nextQuery, prevQuery);
});
}

Expand Down Expand Up @@ -1598,6 +1605,20 @@ function createRouter(options) {
nextState = {};
}

if (typeof location === 'string') {
warning(
!canUseDOM || "production" === 'test',
'You should not use a static location in a DOM environment because ' +
'the router will not be kept in sync with the current URL'
);
} else {
invariant(
canUseDOM,
'You cannot use %s without a DOM',
location
);
}

// Automatically fall back to full page refreshes in
// browsers that don't support the HTML history API.
if (location === HistoryLocation && !supportsHistory())
Expand Down Expand Up @@ -1687,16 +1708,23 @@ function createRouter(options) {
},

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

if (History.length > 1) {
if (History.length > 1 || location === RefreshLocation) {
location.pop();
return true;
}
Expand Down Expand Up @@ -1759,6 +1787,7 @@ function createRouter(options) {

var prevRoutes = state.routes || [];
var prevParams = state.params || {};
var prevQuery = state.query || {};

var nextRoutes = match.routes || [];
var nextParams = match.params || {};
Expand All @@ -1767,27 +1796,17 @@ function createRouter(options) {
var fromRoutes, toRoutes;
if (prevRoutes.length) {
fromRoutes = prevRoutes.filter(function (route) {
return !hasMatch(nextRoutes, route, prevParams, nextParams);
return !hasMatch(nextRoutes, route, prevParams, nextParams, prevQuery, nextQuery);
});

toRoutes = nextRoutes.filter(function (route) {
return !hasMatch(prevRoutes, route, prevParams, nextParams);
return !hasMatch(prevRoutes, route, prevParams, nextParams, prevQuery, nextQuery);
});
} else {
fromRoutes = [];
toRoutes = nextRoutes;
}

// If routes' hooks arrays are empty, then we transition to current route.
// But path is somehow still get changed.
// That could be only because of route query changes.
// Need to push current route to routes' hooks arrays.
if (!toRoutes.length && !fromRoutes.length) {
var currentRoute = state.routes[state.routes.length-1];
fromRoutes = [currentRoute];
toRoutes = [currentRoute];
}

var transition = new Transition(path, this.replaceWith.bind(this, path));
pendingTransition = transition;

Expand Down Expand Up @@ -1832,21 +1851,8 @@ function createRouter(options) {
};

if (typeof location === 'string') {
warning(
!canUseDOM || "production" === 'test',
'You should not use a static location in a DOM environment because ' +
'the router will not be kept in sync with the current URL'
);

// Dispatch the location.
router.dispatch(location, null, dispatchHandler);
} else {
invariant(
canUseDOM,
'You cannot use %s in a non-DOM environment',
location
);

// Listen for changes to the location.
var changeListener = function (change) {
router.dispatch(change.path, change.type, dispatchHandler);
Expand Down Expand Up @@ -1931,7 +1937,6 @@ module.exports = createRouter;

},{"../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){
/* jshint -W084 */

var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
var warning = _dereq_('react/lib/warning');
var invariant = _dereq_('react/lib/invariant');
Expand Down Expand Up @@ -2818,7 +2823,7 @@ var emptyFunction = _dereq_("./emptyFunction");
var warning = emptyFunction;

if ("production" !== "production") {
warning = function(condition, format ) {var args=Array.prototype.slice.call(arguments,2);
warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
Expand Down
4 changes: 2 additions & 2 deletions dist/react-router.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router",
"version": "0.11.5",
"version": "0.11.6",
"description": "A complete routing library for React.js",
"main": "./modules/index",
"repository": {
Expand Down

0 comments on commit 6996451

Please sign in to comment.