diff --git a/src/core/drive/navigator.js b/src/core/drive/navigator.js index 0d7259913..999d97817 100644 --- a/src/core/drive/navigator.js +++ b/src/core/drive/navigator.js @@ -99,7 +99,9 @@ export class Navigator { } else { await this.view.renderPage(snapshot, false, true, this.currentVisit) } - this.view.scrollToTop() + if(!snapshot.shouldPreserveScrollPosition) { + this.view.scrollToTop() + } this.view.clearSnapshotCache() } } diff --git a/src/core/drive/page_view.js b/src/core/drive/page_view.js index 6cf25dfd5..249b73efc 100644 --- a/src/core/drive/page_view.js +++ b/src/core/drive/page_view.js @@ -60,7 +60,7 @@ export class PageView extends View { } isPageRefresh(visit) { - return visit && this.lastRenderedLocation.href === visit.location.href + return !visit || this.lastRenderedLocation.href === visit.location.href } get snapshot() { diff --git a/src/tests/fixtures/page_refresh.html b/src/tests/fixtures/page_refresh.html index d8d948a63..ec28092a4 100644 --- a/src/tests/fixtures/page_refresh.html +++ b/src/tests/fixtures/page_refresh.html @@ -49,6 +49,13 @@