Commit 8b675c9b authored by Jiachi Liu's avatar Jiachi Liu Committed by RobPruzan

trigger the actual same level boundary

parent 7f7c87bd
...@@ -615,6 +615,21 @@ export default function OuterLayoutRouter({ ...@@ -615,6 +615,21 @@ export default function OuterLayoutRouter({
? RenderChildren ? RenderChildren
: ErrorBoundary : ErrorBoundary
let segmentBoundaryTriggerNode: React.ReactNode = null
if (
process.env.NODE_ENV !== 'production' &&
process.env.__NEXT_DEVTOOL_SEGMENT_EXPLORER
) {
const { SegmentBoundaryTriggerNode } =
require('../../next-devtools/userspace/app/segment-explorer-node') as typeof import('../../next-devtools/userspace/app/segment-explorer-node')
segmentBoundaryTriggerNode = (
<>
<SegmentBoundaryTriggerNode />
</>
)
}
// TODO: The loading module data for a segment is stored on the parent, then // TODO: The loading module data for a segment is stored on the parent, then
// applied to each of that parent segment's parallel route slots. In the // applied to each of that parent segment's parallel route slots. In the
// simple case where there's only one parallel route (the `children` slot), // simple case where there's only one parallel route (the `children` slot),
...@@ -647,6 +662,7 @@ export default function OuterLayoutRouter({ ...@@ -647,6 +662,7 @@ export default function OuterLayoutRouter({
cacheNode={cacheNode} cacheNode={cacheNode}
segmentPath={segmentPath} segmentPath={segmentPath}
/> />
{segmentBoundaryTriggerNode}
</RedirectBoundary> </RedirectBoundary>
</HTTPAccessFallbackBoundary> </HTTPAccessFallbackBoundary>
</LoadingBoundary> </LoadingBoundary>
......
...@@ -76,6 +76,19 @@ export function SegmentViewStateNode({ page }: { page: string }) { ...@@ -76,6 +76,19 @@ export function SegmentViewStateNode({ page }: { page: string }) {
return null return null
} }
export function SegmentBoundaryTriggerNode() {
const { boundaryType } = useSegmentState()
let segmentNode: React.ReactNode = null
if (boundaryType === 'loading') {
segmentNode = <LoadingSegmentNode />
} else if (boundaryType === 'not-found') {
segmentNode = <NotFoundSegmentNode />
} else if (boundaryType === 'error') {
segmentNode = <ErrorSegmentNode />
}
return segmentNode
}
export function SegmentViewNode({ export function SegmentViewNode({
type, type,
pagePath, pagePath,
...@@ -85,22 +98,9 @@ export function SegmentViewNode({ ...@@ -85,22 +98,9 @@ export function SegmentViewNode({
pagePath: string pagePath: string
children?: ReactNode children?: ReactNode
}): React.ReactNode { }): React.ReactNode {
const { boundaryType } = useSegmentState() const segmentNode = (
const isChildBoundary = type !== 'layout' && type !== 'template'
let segmentNode = (
<SegmentTrieNode key={type} type={type} pagePath={pagePath} /> <SegmentTrieNode key={type} type={type} pagePath={pagePath} />
) )
if (boundaryType && boundaryType !== type && isChildBoundary) {
if (boundaryType === 'loading') {
segmentNode = <LoadingSegmentNode />
} else if (boundaryType === 'not-found') {
segmentNode = <NotFoundSegmentNode />
} else if (boundaryType === 'error') {
segmentNode = <ErrorSegmentNode />
}
}
return ( return (
<> <>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment