Skip to content

Commit

Permalink
Refactor isMorphable to only allow refresh actions if the pathnam…
Browse files Browse the repository at this point in the history
…es are equal
  • Loading branch information
pfeiffer committed Feb 15, 2024
1 parent a7a3435 commit 1ce2478
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/core/drive/page_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,10 @@ export class PageView extends View {
return this.snapshotCache.get(location)
}

isReplacingSamePage(visit) {
return !visit || (this.lastRenderedLocation.pathname === visit.location.pathname && visit.action === "replace")
}

isRefreshing(visit) {
return visit && visit.action === "refresh"
}

isMorphable(visit) {
return this.isRefreshing(visit) || this.isReplacingSamePage(visit)
if (!visit) { return true }

return this.lastRenderedLocation.pathname === visit.location.pathname && (visit.action === "replace" || visit.action === "refresh")
}

shouldPreserveScrollPosition(visit) {
Expand Down

0 comments on commit 1ce2478

Please sign in to comment.