Skip to content

Commit

Permalink
Update with last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemanrubia committed Nov 13, 2023
1 parent 9d3fdeb commit a49f6a6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/assets/javascripts/turbo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,9 @@ class Navigator {
} else {
await this.view.renderPage(snapshot, false, true, this.currentVisit);
}
this.view.scrollToTop();
if (!snapshot.shouldPreserveScrollPosition) {
this.view.scrollToTop();
}
this.view.clearSnapshotCache();
}
}
Expand Down Expand Up @@ -3737,7 +3739,7 @@ class PageView extends View {
return this.snapshotCache.get(location);
}
isPageRefresh(visit) {
return visit && this.lastRenderedLocation.href === visit.location.href;
return !visit || this.lastRenderedLocation.href === visit.location.href;
}
get snapshot() {
return PageSnapshot.fromElement(this.element);
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/turbo.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/assets/javascripts/turbo.min.js.map

Large diffs are not rendered by default.

0 comments on commit a49f6a6

Please sign in to comment.