-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(turbopack): allow page segments that don't alter the path after c…
…atchall (#67713) ### What? Parallel routes and groups were not allowed after a catch-all segment on the turbopack side previously. Closes PACK-2975 Fixes #64600
- Loading branch information
1 parent
005a776
commit 29af5dc
Showing
9 changed files
with
104 additions
and
5 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
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/catchall-parallel-routes-group/app/[...catchAll]/@slot/(group)/page.tsx
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,3 @@ | ||
export default function Page() { | ||
return <h4 id="catch-all-slot-group-page">Catch-all Slot Group Page</h4> | ||
} |
10 changes: 10 additions & 0 deletions
10
test/e2e/app-dir/catchall-parallel-routes-group/app/[...catchAll]/@slot/layout.tsx
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,10 @@ | ||
import { ReactNode } from 'react' | ||
|
||
export default function Layout({ children }: { children: ReactNode }) { | ||
return ( | ||
<div> | ||
<h3 id="catch-all-slot-layout">Catch-all Slot Layout</h3> | ||
{children} | ||
</div> | ||
) | ||
} |
17 changes: 17 additions & 0 deletions
17
test/e2e/app-dir/catchall-parallel-routes-group/app/[...catchAll]/layout.tsx
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,17 @@ | ||
import { ReactNode } from 'react' | ||
|
||
export default function Layout({ | ||
children, | ||
slot, | ||
}: { | ||
children: ReactNode | ||
slot: ReactNode | ||
}) { | ||
return ( | ||
<div id="catch-all-layout"> | ||
<h2>Catch-all Layout</h2> | ||
{slot} | ||
{children} | ||
</div> | ||
) | ||
} |
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/catchall-parallel-routes-group/app/[...catchAll]/page.tsx
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,3 @@ | ||
export default function Page() { | ||
return <h3 id="catch-all-page">Catch-all Page</h3> | ||
} |
14 changes: 14 additions & 0 deletions
14
test/e2e/app-dir/catchall-parallel-routes-group/app/layout.tsx
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,14 @@ | ||
import { ReactNode } from 'react' | ||
|
||
export default function Root({ children }: { children: ReactNode }) { | ||
return ( | ||
<html> | ||
<body> | ||
<div id="root-layout"> | ||
<h1>Root Layout</h1> | ||
{children} | ||
</div> | ||
</body> | ||
</html> | ||
) | ||
} |
12 changes: 12 additions & 0 deletions
12
test/e2e/app-dir/catchall-parallel-routes-group/app/page.tsx
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,12 @@ | ||
import Link from 'next/link' | ||
|
||
export default function Page() { | ||
return ( | ||
<div id="root-page"> | ||
<h2>Root Page</h2> | ||
<div> | ||
<Link href="/foobar">To /foobar (catchall)</Link> | ||
</div> | ||
</div> | ||
) | ||
} |
22 changes: 22 additions & 0 deletions
22
test/e2e/app-dir/catchall-parallel-routes-group/catchall-parallel-routes-group.test.ts
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,22 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
import { check } from 'next-test-utils' | ||
|
||
describe('catchall-parallel-routes-group', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
it('should work without throwing any errors about invalid pages', async () => { | ||
const browser = await next.browser('/') | ||
|
||
await check(() => browser.elementByCss('body').text(), /Root Page/) | ||
await browser.elementByCss('[href="/foobar"]').click() | ||
|
||
// catch all matches page, but also slot with layout and group | ||
await check(() => browser.elementByCss('body').text(), /Catch-all Page/) | ||
await check( | ||
() => browser.elementByCss('body').text(), | ||
/Catch-all Slot Group Page/ | ||
) | ||
}) | ||
}) |
6 changes: 6 additions & 0 deletions
6
test/e2e/app-dir/catchall-parallel-routes-group/next.config.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,6 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
const nextConfig = {} | ||
|
||
module.exports = nextConfig |