Skip to content

Commit

Permalink
Fix page loads when refreshing location with anchor.
Browse files Browse the repository at this point in the history
Update the same-page check, making it possible to refresh a location such as example.com#main
  • Loading branch information
domchristie committed Aug 5, 2021
1 parent ab1c19f commit a308970
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/drive/navigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,13 @@ export class Navigator {
}

locationWithActionIsSamePage(location: URL, action?: Action): boolean {
const anchor = getAnchor(location)
const currentAnchor = getAnchor(this.view.lastRenderedLocation)
const isRestorationToTop = action === 'restore' && typeof anchor === 'undefined'

return action !== "replace" &&
getRequestURL(location) === getRequestURL(this.view.lastRenderedLocation) &&
(getAnchor(location) != null || action == "restore")
(isRestorationToTop || (anchor != null && anchor !== currentAnchor))
}

visitScrolledToSamePageLocation(oldURL: URL, newURL: URL) {
Expand Down

0 comments on commit a308970

Please sign in to comment.