forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix prefetch and some other issues with optional catch all (vercel#14400
) Fix vercel#14290 and a couple other issues around optional catch-all that popped up after writing these tests Closes vercel#14344
- Loading branch information
Showing
6 changed files
with
124 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
module.exports = { | ||
experimental: { | ||
optionalCatchAll: true, | ||
rewrites() { | ||
return [ | ||
{ | ||
|
29 changes: 29 additions & 0 deletions
29
test/integration/prerender/pages/catchall-optional/[[...slug]].js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Link from 'next/link' | ||
|
||
export async function getStaticProps({ params: { slug } }) { | ||
return { | ||
props: { | ||
slug: slug || [], | ||
}, | ||
} | ||
} | ||
|
||
export async function getStaticPaths() { | ||
return { | ||
paths: [{ params: { slug: [] } }, { params: { slug: ['value'] } }], | ||
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">Catch all: [{slug.join(', ')}]</p> | ||
<Link href="/"> | ||
<a id="home">to home</a> | ||
</Link> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters