Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
b4e2b7bd
Commit
b4e2b7bd
authored
Jan 25, 2017
by
Arunoda Susiripala
Committed by
Naoyuki Kanezawa
Jan 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handles the initial popstate event of older version of Safari. (#870)
parent
f89eaf31
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
router.js
lib/router/router.js
+9
-1
No files found.
lib/router/router.js
View file @
b4e2b7bd
...
@@ -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
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment