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
5383ad7e
Commit
5383ad7e
authored
Nov 06, 2016
by
nkzawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix getInitialProps doesn't get called when only url query was changed
parent
efbf0efc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
13 deletions
+6
-13
router.js
lib/router.js
+6
-13
No files found.
lib/router.js
View file @
5383ad7e
...
...
@@ -32,11 +32,8 @@ export default class Router {
Promise
.
resolve
()
.
then
(
async
()
=>
{
const
data
=
await
this
.
fetchComponent
(
route
)
let
props
if
(
route
!==
this
.
route
)
{
const
ctx
=
{
...
data
.
ctx
,
pathname
,
query
}
props
=
await
this
.
getInitialProps
(
data
.
Component
,
ctx
)
}
const
ctx
=
{
...
data
.
ctx
,
pathname
,
query
}
const
props
=
await
this
.
getInitialProps
(
data
.
Component
,
ctx
)
this
.
route
=
route
this
.
set
(
getURL
(),
{
...
data
,
props
})
...
...
@@ -72,10 +69,8 @@ export default class Router {
let
props
try
{
data
=
await
this
.
fetchComponent
(
route
)
if
(
route
===
this
.
route
)
{
const
ctx
=
{
...
data
.
ctx
,
pathname
,
query
}
props
=
await
this
.
getInitialProps
(
data
.
Component
,
ctx
)
}
const
ctx
=
{
...
data
.
ctx
,
pathname
,
query
}
props
=
await
this
.
getInitialProps
(
data
.
Component
,
ctx
)
}
catch
(
err
)
{
if
(
err
.
cancelled
)
return
false
throw
err
...
...
@@ -107,10 +102,8 @@ export default class Router {
let
props
try
{
data
=
await
this
.
fetchComponent
(
route
)
if
(
route
!==
this
.
route
)
{
const
ctx
=
{
...
data
.
ctx
,
pathname
,
query
}
props
=
await
this
.
getInitialProps
(
data
.
Component
,
ctx
)
}
const
ctx
=
{
...
data
.
ctx
,
pathname
,
query
}
props
=
await
this
.
getInitialProps
(
data
.
Component
,
ctx
)
}
catch
(
err
)
{
if
(
err
.
cancelled
)
return
false
throw
err
...
...
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