({
parallelRouterKey,
error,
errorStyles,
errorScripts,
templateStyles,
templateScripts,
template,
notFound,
forbidden,
unauthorized,
segmentViewBoundaries,
}: {
parallelRouterKey: string
error: ErrorComponent | undefined
errorStyles: React.ReactNode | undefined
errorScripts: React.ReactNode | undefined
templateStyles: React.ReactNode | undefined
templateScripts: React.ReactNode | undefined
template: React.ReactNode
notFound: React.ReactNode | undefined
forbidden: React.ReactNode | undefined
unauthorized: React.ReactNode | undefined
segmentViewBoundaries?: React.ReactNode
})
| 597 | * It can be rendered next to each other with a different `parallelRouterKey`, allowing for Parallel routes. |
| 598 | */ |
| 599 | export default function OuterLayoutRouter({ |
| 600 | parallelRouterKey, |
| 601 | error, |
| 602 | errorStyles, |
| 603 | errorScripts, |
| 604 | templateStyles, |
| 605 | templateScripts, |
| 606 | template, |
| 607 | notFound, |
| 608 | forbidden, |
| 609 | unauthorized, |
| 610 | segmentViewBoundaries, |
| 611 | }: { |
| 612 | parallelRouterKey: string |
| 613 | error: ErrorComponent | undefined |
| 614 | errorStyles: React.ReactNode | undefined |
| 615 | errorScripts: React.ReactNode | undefined |
| 616 | templateStyles: React.ReactNode | undefined |
| 617 | templateScripts: React.ReactNode | undefined |
| 618 | template: React.ReactNode |
| 619 | notFound: React.ReactNode | undefined |
| 620 | forbidden: React.ReactNode | undefined |
| 621 | unauthorized: React.ReactNode | undefined |
| 622 | segmentViewBoundaries?: React.ReactNode |
| 623 | }) { |
| 624 | const context = useContext(LayoutRouterContext) |
| 625 | if (!context) { |
| 626 | throw new Error('invariant expected layout router to be mounted') |
| 627 | } |
| 628 | |
| 629 | const { |
| 630 | parentTree, |
| 631 | parentCacheNode, |
| 632 | parentSegmentPath, |
| 633 | parentParams, |
| 634 | parentLoadingData, |
| 635 | url, |
| 636 | isActive, |
| 637 | debugNameContext, |
| 638 | } = context |
| 639 | |
| 640 | // Get the CacheNode for this segment by reading it from the parent segment's |
| 641 | // child map. |
| 642 | const parentTreeSegment = parentTree[0] |
| 643 | const segmentPath = |
| 644 | parentSegmentPath === null |
| 645 | ? // TODO: The root segment value is currently omitted from the segment |
| 646 | // path. This has led to a bunch of special cases scattered throughout |
| 647 | // the code. We should clean this up. |
| 648 | [parallelRouterKey] |
| 649 | : parentSegmentPath.concat([parentTreeSegment, parallelRouterKey]) |
| 650 | |
| 651 | // The "state" key of a segment is the one passed to React — it represents the |
| 652 | // identity of the UI tree. Whenever the state key changes, the tree is |
| 653 | // recreated and the state is reset. In the App Router model, search params do |
| 654 | // not cause state to be lost, so two segments with the same segment path but |
| 655 | // different search params should have the same state key. |
| 656 | // |
nothing calls this directly
no test coverage detected