Commit b4e2b7bd authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by Naoyuki Kanezawa

Handles the initial popstate event of older version of Safari. (#870)

parent f89eaf31
...@@ -34,9 +34,17 @@ export default class Router extends EventEmitter { ...@@ -34,9 +34,17 @@ export default class Router extends EventEmitter {
} }
async onPopState (e) { async onPopState (e) {
// Older versions of safari and chrome tend to fire popstate event at the
// page load.
// We should not complete that event and the following check will fix it.
// Fixes:
if (!e.state) {
return
}
this.abortComponentLoad() this.abortComponentLoad()
const { url = getURL(), as = url } = e.state || {} const { url, as } = e.state
const { pathname, query } = parse(url, true) const { pathname, query } = parse(url, true)
if (!this.urlIsNew(pathname, query)) { if (!this.urlIsNew(pathname, query)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment