mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### 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
20 lines
430 B
TypeScript
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>
|
|
)
|
|
}
|