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
92b0a690
Commit
92b0a690
authored
May 18, 2017
by
Arunoda Susiripala
Committed by
GitHub
May 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a default value of '{}' to query in the export mode. (#2003)
parent
a8fdbb26
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
1 deletion
+18
-1
export.js
server/export.js
+1
-1
next.config.js
test/integration/static/next.config.js
+1
-0
get-initial-props-with-no-query.js
...tegration/static/pages/get-initial-props-with-no-query.js
+11
-0
ssr.js
test/integration/static/test/ssr.js
+5
-0
No files found.
server/export.js
View file @
92b0a690
...
@@ -88,7 +88,7 @@ export default async function (dir, options) {
...
@@ -88,7 +88,7 @@ export default async function (dir, options) {
for
(
const
path
of
exportPaths
)
{
for
(
const
path
of
exportPaths
)
{
log
(
` exporting path:
${
path
}
`
)
log
(
` exporting path:
${
path
}
`
)
const
{
page
,
query
}
=
exportPathMap
[
path
]
const
{
page
,
query
=
{}
}
=
exportPathMap
[
path
]
const
req
=
{
url
:
path
}
const
req
=
{
url
:
path
}
const
res
=
{}
const
res
=
{}
...
...
test/integration/static/next.config.js
View file @
92b0a690
...
@@ -3,6 +3,7 @@ module.exports = {
...
@@ -3,6 +3,7 @@ module.exports = {
return
{
return
{
'/'
:
{
page
:
'/'
},
'/'
:
{
page
:
'/'
},
'/about'
:
{
page
:
'/about'
},
'/about'
:
{
page
:
'/about'
},
'/get-initial-props-with-no-query'
:
{
page
:
'/get-initial-props-with-no-query'
},
'/counter'
:
{
page
:
'/counter'
},
'/counter'
:
{
page
:
'/counter'
},
'/dynamic-imports'
:
{
page
:
'/dynamic-imports'
},
'/dynamic-imports'
:
{
page
:
'/dynamic-imports'
},
'/dynamic'
:
{
page
:
'/dynamic'
,
query
:
{
text
:
'cool dynamic text'
}
},
'/dynamic'
:
{
page
:
'/dynamic'
,
query
:
{
text
:
'cool dynamic text'
}
},
...
...
test/integration/static/pages/get-initial-props-with-no-query.js
0 → 100644
View file @
92b0a690
const
Page
=
({
query
})
=>
(
<
div
>
{
`Query is:
${
query
}
`
}
<
/div
>
)
Page
.
getInitialProps
=
({
query
})
=>
{
return
{
query
:
JSON
.
stringify
(
query
)
}
}
export
default
Page
test/integration/static/test/ssr.js
View file @
92b0a690
...
@@ -22,5 +22,10 @@ export default function (context) {
...
@@ -22,5 +22,10 @@ export default function (context) {
const
html
=
await
renderViaHTTP
(
context
.
port
,
'/dynamic-imports'
)
const
html
=
await
renderViaHTTP
(
context
.
port
,
'/dynamic-imports'
)
expect
(
html
).
toMatch
(
/Welcome to dynamic imports./
)
expect
(
html
).
toMatch
(
/Welcome to dynamic imports./
)
})
})
it
(
'should give empty object for query if there is no query'
,
async
()
=>
{
const
html
=
await
renderViaHTTP
(
context
.
port
,
'/get-initial-props-with-no-query'
)
expect
(
html
).
toMatch
(
/Query is: {}/
)
})
})
})
}
}
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