Files
Zack TannerandGitHub c9321c72c9 parallel routes: support multi-slot layouts (#61115)
### What?
When using layouts in multiple parallel route slots, only 1 of the
layouts would render.

### Why?
The `resolveParallelSegments` logic responsible for populating the
loader tree was incorrectly bailing if it found another parallel route
that matched a page component.

### How?
I did my best to update this loader code with some more comments to make
it a bit easier to reason about, and also made some slight refactors.
But the gist of the fix is just ensuring that each parallel route (that
isn't a direct match on the `children` slot) is resolved as an array, so
that when the subtree is created, it doesn't skip over the slot.

Fixes #58506
Fixes #59463

Closes NEXT-2222
2024-01-26 11:46:23 -08:00

20 lines
430 B
TypeScript

import Link from 'next/link'
import React from 'react'
export default function Root({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
<div>
<Link href="/nested">to nested</Link>
</div>
<div>
<Link href="/nested/subroute">to nested subroute</Link>
</div>
<h1>Root Layout</h1>
<div>{children}</div>
</body>
</html>
)
}