mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Handles the initial popstate event of older version of Safari. (#870)
This commit is contained in:
parent
f89eaf315c
commit
b4e2b7bd4d
|
@ -34,9 +34,17 @@ export default class Router extends EventEmitter {
|
|||
}
|
||||
|
||||
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()
|
||||
|
||||
const { url = getURL(), as = url } = e.state || {}
|
||||
const { url, as } = e.state
|
||||
const { pathname, query } = parse(url, true)
|
||||
|
||||
if (!this.urlIsNew(pathname, query)) {
|
||||
|
|
Loading…
Reference in a new issue