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
2347e3e4
Unverified
Commit
2347e3e4
authored
Dec 11, 2019
by
Joe Haddad
Committed by
GitHub
Dec 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust return value (#9712)
* Adjust return value * Add delay
parent
918b3793
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
9 deletions
+14
-9
load-components.ts
packages/next/next-server/server/load-components.ts
+1
-1
render.tsx
packages/next/next-server/server/render.tsx
+6
-6
index.js
test/integration/prerender/pages/another/index.js
+1
-1
index.test.js
test/integration/prerender/test/index.test.js
+6
-1
No files found.
packages/next/next-server/server/load-components.ts
View file @
2347e3e4
...
...
@@ -19,7 +19,7 @@ export type LoadComponentsReturnType = {
params
:
any
})
=>
{
props
:
any
revalidate
:
number
|
false
revalidate
?:
number
|
boolean
}
unstable_getStaticPaths
?:
()
=>
void
buildManifest
?:
any
...
...
packages/next/next-server/server/render.tsx
View file @
2347e3e4
...
...
@@ -156,7 +156,7 @@ type RenderOpts = {
params
:
any
|
undefined
})
=>
{
props
:
any
revalidate
:
number
|
false
revalidate
?:
number
|
boolean
}
unstable_getStaticPaths
?:
()
=>
void
}
...
...
@@ -458,14 +458,14 @@ export async function renderToHTML(
`\nTo only run getStaticProps at build-time and not revalidate at runtime, you can set \`revalidate\` to \`false\`!`
)
}
}
else
if
(
data
.
revalidate
===
false
)
{
// `false` is an allowed behavior. We'll catch `revalidate: true` and
// fall into our default behavior.
}
else
{
// By default, we revalidate after 1 second. This value is optimal for
}
else
if
(
data
.
revalidate
===
true
)
{
// When enabled, revalidate after 1 second. This value is optimal for
// the most up-to-date page possible, but without a 1-to-1
// request-refresh ratio.
data
.
revalidate
=
1
}
else
{
// By default, we never revalidate.
data
.
revalidate
=
false
}
props
.
pageProps
=
data
.
props
...
...
test/integration/prerender/pages/another/index.js
View file @
2347e3e4
...
...
@@ -19,7 +19,7 @@ export async function unstable_getStaticProps() {
world
:
text
,
time
:
new
Date
().
getTime
(),
},
revalidate
:
1
,
revalidate
:
true
,
}
}
...
...
test/integration/prerender/test/index.test.js
View file @
2347e3e4
...
...
@@ -93,7 +93,7 @@ const expectedManifestRoutes = () => ({
},
'/default-revalidate'
:
{
dataRoute
:
`/_next/data/
${
buildId
}
/default-revalidate.json`
,
initialRevalidateSeconds
:
1
,
initialRevalidateSeconds
:
false
,
srcRoute
:
null
,
},
'/something'
:
{
...
...
@@ -114,12 +114,17 @@ const navigateTest = () => {
'/blog/post-1/comment-1'
,
]
await
waitFor
(
2500
)
await
Promise
.
all
(
toBuild
.
map
(
pg
=>
renderViaHTTP
(
appPort
,
pg
)))
const
browser
=
await
webdriver
(
appPort
,
'/'
)
let
text
=
await
browser
.
elementByCss
(
'p'
).
text
()
expect
(
text
).
toMatch
(
/hello.*
?
world/
)
// hydration
await
waitFor
(
2500
)
// go to /another
await
browser
.
elementByCss
(
'#another'
).
click
()
await
browser
.
waitForElementByCss
(
'#home'
)
...
...
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