Commit 5383ad7e authored by nkzawa's avatar nkzawa

fix getInitialProps doesn't get called when only url query was changed

parent efbf0efc
......@@ -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
......
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