Skip to content

Commit 37eebf5

Browse files
committed
release v0.9.5
1 parent fb87b23 commit 37eebf5

File tree

5 files changed

+41
-19
lines changed

5 files changed

+41
-19
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
v0.9.5 - Thu, 30 Oct 2014 04:50:09 GMT
2+
--------------------------------------
3+
4+
- [fb87b23](../../commit/fb87b23) Revert "Revert "Revert "[removed] "static" <Route> props"""
5+
- [53bc0fb](../../commit/53bc0fb) Revert "Revert "[removed] "static" <Route> props""
6+
- [6192285](../../commit/6192285) [added] <Route ignoreScrollBehavior /> to opt out of scroll behavior for itself and descendants
7+
8+
19
v0.9.4 - Mon, 13 Oct 2014 19:53:10 GMT
210
--------------------------------------
311

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router",
3-
"version": "0.9.4",
3+
"version": "0.9.5",
44
"homepage": "https://github.com/rackt/react-router",
55
"authors": [
66
"Ryan Florence",

dist/react-router.js

+27-13
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ var Route = React.createClass({
329329
propTypes: {
330330
handler: React.PropTypes.any.isRequired,
331331
path: React.PropTypes.string,
332-
name: React.PropTypes.string
332+
name: React.PropTypes.string,
333+
ignoreScrollBehavior: React.PropTypes.bool
333334
},
334335

335336
render: function () {
@@ -509,6 +510,16 @@ function updateMatchComponents(matches, refs) {
509510
}
510511
}
511512

513+
function shouldUpdateScroll(currentMatches, previousMatches) {
514+
var commonMatches = currentMatches.filter(function (match) {
515+
return previousMatches.indexOf(match) !== -1;
516+
});
517+
518+
return !commonMatches.some(function (match) {
519+
return match.route.props.ignoreScrollBehavior;
520+
});
521+
}
522+
512523
function returnNull() {
513524
return null;
514525
}
@@ -581,17 +592,11 @@ var Routes = React.createClass({
581592
'inside some other component\'s render method'
582593
);
583594

584-
if (this._handleStateChange) {
585-
this._handleStateChange();
586-
delete this._handleStateChange;
587-
}
595+
this._handleStateChange();
588596
},
589597

590598
componentDidUpdate: function () {
591-
if (this._handleStateChange) {
592-
this._handleStateChange();
593-
delete this._handleStateChange;
594-
}
599+
this._handleStateChange();
595600
},
596601

597602
/**
@@ -631,16 +636,25 @@ var Routes = React.createClass({
631636
} else if (abortReason) {
632637
this.goBack();
633638
} else {
634-
this._handleStateChange = this.handleStateChange.bind(this, path, actionType);
639+
this._nextStateChangeHandler = this._finishTransitionTo.bind(this, path, actionType, this.state.matches);
635640
this.setState(nextState);
636641
}
637642
});
638643
},
639644

640-
handleStateChange: function (path, actionType) {
641-
updateMatchComponents(this.state.matches, this.refs);
645+
_handleStateChange: function () {
646+
if (this._nextStateChangeHandler) {
647+
this._nextStateChangeHandler();
648+
delete this._nextStateChangeHandler;
649+
}
650+
},
651+
652+
_finishTransitionTo: function (path, actionType, previousMatches) {
653+
var currentMatches = this.state.matches;
654+
updateMatchComponents(currentMatches, this.refs);
642655

643-
this.updateScroll(path, actionType);
656+
if (shouldUpdateScroll(currentMatches, previousMatches))
657+
this.updateScroll(path, actionType);
644658

645659
if (this.props.onChange)
646660
this.props.onChange.call(this);

dist/react-router.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

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

0 commit comments

Comments
 (0)