Skip to content

Commit d6b927a

Browse files
committed
Merge pull request #398 from gaearon/fix-scroll-behavior-call
Call updateScrollPosition for the first time as well
2 parents b9416bc + ea4bec0 commit d6b927a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

modules/behaviors/ImitateBrowserBehavior.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ var ImitateBrowserBehavior = {
1313
window.scrollTo(0, 0);
1414
break;
1515
case LocationActions.POP:
16-
window.scrollTo(position.x, position.y);
16+
if (position) {
17+
window.scrollTo(position.x, position.y);
18+
} else {
19+
window.scrollTo(0, 0);
20+
}
1721
break;
1822
}
1923
}

modules/mixins/ScrollContext.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ var ScrollContext = {
6060

6161
updateScroll: function (path, actionType) {
6262
var behavior = this.getScrollBehavior();
63-
var position = this.getScrollPosition(path);
63+
var position = this.getScrollPosition(path) || null;
6464

65-
if (behavior && position)
65+
if (behavior)
6666
behavior.updateScrollPosition(position, actionType);
6767
},
6868

0 commit comments

Comments
 (0)