Skip to content

Commit

Permalink
fix: prevent error on initial navigation to //invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed May 12, 2020
1 parent 5031dc2 commit e72e4ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/history/html5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { stripBase } from '../location'

type PopStateListener = (this: Window, ev: PopStateEvent) => any

let createBaseLocation = () => location.protocol + '//' + location.host

interface StateEntry extends HistoryState {
back: HistoryLocationNormalized | null
current: HistoryLocationNormalized
Expand Down Expand Up @@ -200,7 +202,7 @@ function useHistoryStateNavigation(base: string) {
state: StateEntry,
replace: boolean
): void {
const url = base + to.fullPath
const url = createBaseLocation() + base + to.fullPath
try {
// BROWSER QUIRK
// NOTE: Safari throws a SecurityError when calling this function 100 times in 30 seconds
Expand Down

0 comments on commit e72e4ba

Please sign in to comment.