Skip to content

Commit

Permalink
Remove 'undefined' from history.replaceState() optional url parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
dipscom committed Aug 5, 2021
1 parent f0f3842 commit edbb5d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Router.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export async function push(location) {
await tick()
// Note: this will include scroll state in history even when restoreScrollState is false
history.replaceState({...history.state, __svelte_spa_router_scrollX: window.scrollX, __svelte_spa_router_scrollY: window.scrollY}, undefined, undefined)
history.replaceState({...history.state, __svelte_spa_router_scrollX: window.scrollX, __svelte_spa_router_scrollY: window.scrollY}, undefined)
window.location.hash = (location.charAt(0) == '#' ? '' : '#') + location
}
Expand Down Expand Up @@ -235,7 +235,7 @@ function linkOpts(val) {
*/
function scrollstateHistoryHandler(href) {
// Setting the url (3rd arg) to href will break clicking for reasons, so don't try to do that
history.replaceState({...history.state, __svelte_spa_router_scrollX: window.scrollX, __svelte_spa_router_scrollY: window.scrollY}, undefined, undefined)
history.replaceState({...history.state, __svelte_spa_router_scrollX: window.scrollX, __svelte_spa_router_scrollY: window.scrollY}, undefined)
// This will force an update as desired, but this time our scroll state will be attached
window.location.hash = href
}
Expand Down

0 comments on commit edbb5d2

Please sign in to comment.