rsnext/test/integration/prerender/pages/catchall-explicit/[...slug].js
JJ Kasper 97a6b64f83
Rename unstable GSP field (#11602)
* Rename unstable GSP revalidate field

* Update error message

* Tweak error message some more

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-04-02 14:29:41 -04:00

30 lines
704 B
JavaScript

export async function getStaticProps({ params: { slug } }) {
if (slug[0] === 'delayby3s') {
await new Promise(resolve => setTimeout(resolve, 3000))
}
return {
props: {
slug,
},
unstable_revalidate: 1,
}
}
export async function getStaticPaths() {
return {
paths: [
{ params: { slug: ['first'] } },
'/catchall-explicit/second',
{ params: { slug: ['another', 'value'] } },
'/catchall-explicit/hello/another',
],
fallback: false,
}
}
export default ({ slug }) => {
// Important to not check for `slug` existence (testing that build does not
// render fallback version and error)
return <p id="catchall">Hi {slug.join(' ')}</p>
}