Skip to content

Commit

Permalink
release v0.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanflorence committed Oct 30, 2014
1 parent fb87b23 commit 37eebf5
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 19 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
v0.9.5 - Thu, 30 Oct 2014 04:50:09 GMT
--------------------------------------

- [fb87b23](../../commit/fb87b23) Revert "Revert "Revert "[removed] "static" <Route> props"""
- [53bc0fb](../../commit/53bc0fb) Revert "Revert "[removed] "static" <Route> props""
- [6192285](../../commit/6192285) [added] <Route ignoreScrollBehavior /> to opt out of scroll behavior for itself and descendants


v0.9.4 - Mon, 13 Oct 2014 19:53:10 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.9.4",
"version": "0.9.5",
"homepage": "https://github.com/rackt/react-router",
"authors": [
"Ryan Florence",
Expand Down
40 changes: 27 additions & 13 deletions dist/react-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ var Route = React.createClass({
propTypes: {
handler: React.PropTypes.any.isRequired,
path: React.PropTypes.string,
name: React.PropTypes.string
name: React.PropTypes.string,
ignoreScrollBehavior: React.PropTypes.bool
},

render: function () {
Expand Down Expand Up @@ -509,6 +510,16 @@ function updateMatchComponents(matches, refs) {
}
}

function shouldUpdateScroll(currentMatches, previousMatches) {
var commonMatches = currentMatches.filter(function (match) {
return previousMatches.indexOf(match) !== -1;
});

return !commonMatches.some(function (match) {
return match.route.props.ignoreScrollBehavior;
});
}

function returnNull() {
return null;
}
Expand Down Expand Up @@ -581,17 +592,11 @@ var Routes = React.createClass({
'inside some other component\'s render method'
);

if (this._handleStateChange) {
this._handleStateChange();
delete this._handleStateChange;
}
this._handleStateChange();
},

componentDidUpdate: function () {
if (this._handleStateChange) {
this._handleStateChange();
delete this._handleStateChange;
}
this._handleStateChange();
},

/**
Expand Down Expand Up @@ -631,16 +636,25 @@ var Routes = React.createClass({
} else if (abortReason) {
this.goBack();
} else {
this._handleStateChange = this.handleStateChange.bind(this, path, actionType);
this._nextStateChangeHandler = this._finishTransitionTo.bind(this, path, actionType, this.state.matches);
this.setState(nextState);
}
});
},

handleStateChange: function (path, actionType) {
updateMatchComponents(this.state.matches, this.refs);
_handleStateChange: function () {
if (this._nextStateChangeHandler) {
this._nextStateChangeHandler();
delete this._nextStateChangeHandler;
}
},

_finishTransitionTo: function (path, actionType, previousMatches) {
var currentMatches = this.state.matches;
updateMatchComponents(currentMatches, this.refs);

this.updateScroll(path, actionType);
if (shouldUpdateScroll(currentMatches, previousMatches))
this.updateScroll(path, actionType);

if (this.props.onChange)
this.props.onChange.call(this);
Expand Down
8 changes: 4 additions & 4 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.9.4",
"version": "0.9.5",
"description": "A complete routing library for React.js",
"main": "./modules/index",
"repository": {
Expand Down

0 comments on commit 37eebf5

Please sign in to comment.