Skip to content

Commit caf3a2b

Browse files
committed
Fix scrollBehavior='none' on path update
Fixes #369. Test Plan: npm test
1 parent 93e7341 commit caf3a2b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

modules/mixins/ScrollContext.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ var ScrollContext = {
7676

7777
updateScroll: function (path, actionType) {
7878
var behavior = this.getScrollBehavior();
79-
var position = this._scrollPositions[path];
8079

81-
if (behavior && position)
82-
behavior.updateScrollPosition(position, actionType);
80+
if (behavior != null && this._scrollPositions.hasOwnProperty(path)) {
81+
behavior.updateScrollPosition(this._scrollPositions[path], actionType);
82+
}
8383
},
8484

8585
/**

modules/mixins/__tests__/ScrollContext-test.js

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ describe('ScrollContext', function () {
2929
it('has a null scroll behavior', function () {
3030
expect(component.getScrollBehavior()).toBe(null);
3131
});
32+
33+
it('does not throw when updating scroll position', function () {
34+
expect(function() {
35+
component.updateScroll('/');
36+
}).toNotThrow();
37+
});
3238
});
3339

3440
describe('when using scrollBehavior="browser"', function () {

0 commit comments

Comments
 (0)