Skip to content

Commit

Permalink
Merge branch 'canary' into add/more-config-options
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Dec 11, 2019
2 parents f4daa09 + 2347e3e commit bd43f9a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pool:
vmImage: 'vs2017-win2016'
vmImage: 'windows-2019'

variables:
NEXT_TELEMETRY_DISABLED: '1'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/next-server/server/load-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type LoadComponentsReturnType = {
params: any
}) => {
props: any
revalidate: number | false
revalidate?: number | boolean
}
unstable_getStaticPaths?: () => void
buildManifest?: any
Expand Down
12 changes: 6 additions & 6 deletions packages/next/next-server/server/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ type RenderOpts = {
params: any | undefined
}) => {
props: any
revalidate: number | false
revalidate?: number | boolean
}
unstable_getStaticPaths?: () => void
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/integration/prerender/pages/another/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function unstable_getStaticProps() {
world: text,
time: new Date().getTime(),
},
revalidate: 1,
revalidate: true,
}
}

Expand Down
7 changes: 6 additions & 1 deletion test/integration/prerender/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const expectedManifestRoutes = () => ({
},
'/default-revalidate': {
dataRoute: `/_next/data/${buildId}/default-revalidate.json`,
initialRevalidateSeconds: 1,
initialRevalidateSeconds: false,
srcRoute: null,
},
'/something': {
Expand All @@ -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')
Expand Down

0 comments on commit bd43f9a

Please sign in to comment.