8bac412845
Fixes https://github.com/vercel/next.js/issues/13524 To do: - [x] fix dev mode - [x] there's a ~route ordering or~ trailing slash issue with top level catch-all (current tests reflect that) - [x] in this test `/get-static-paths/whatever` should fall back to `/[[...optionalName]].js` since `fallback` is `false` in its `getStaticPaths` method. ~Currently seems to 500~ must have been a glitch - [x] add tests for `null`, `undefined` ~and `false`~ behavior as well (if decided these are valid) - [x] ~add tests for string params as well~ this is not allowed for catch-all routes - [x] test behavior when fallback is enabled and a top level catch-all exists
25 lines
466 B
JavaScript
25 lines
466 B
JavaScript
export async function getStaticPaths() {
|
|
return {
|
|
paths: [
|
|
{
|
|
params: { slug: undefined },
|
|
},
|
|
],
|
|
fallback: false,
|
|
}
|
|
}
|
|
|
|
export async function getStaticProps({ params }) {
|
|
return { props: { params } }
|
|
}
|
|
|
|
export default function Index(props) {
|
|
return (
|
|
<div id="route">
|
|
gsp undefined route:{' '}
|
|
{props.params.slug === undefined
|
|
? 'undefined'
|
|
: `[${props.params.slug.join('|')}]`}
|
|
</div>
|
|
)
|
|
}
|