Skip to content

Commit 3db0408

Browse files
committed
trigger the actual same level boundary
1 parent e7b9d2b commit 3db0408

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

packages/next/src/client/components/layout-router.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,21 @@ export default function OuterLayoutRouter({
615615
? RenderChildren
616616
: ErrorBoundary
617617

618+
let segmentBoundaryTriggerNode: React.ReactNode = null
619+
if (
620+
process.env.NODE_ENV !== 'production' &&
621+
process.env.__NEXT_DEVTOOL_SEGMENT_EXPLORER
622+
) {
623+
const { SegmentBoundaryTriggerNode } =
624+
require('../../next-devtools/userspace/app/segment-explorer-node') as typeof import('../../next-devtools/userspace/app/segment-explorer-node')
625+
626+
segmentBoundaryTriggerNode = (
627+
<>
628+
<SegmentBoundaryTriggerNode />
629+
</>
630+
)
631+
}
632+
618633
// TODO: The loading module data for a segment is stored on the parent, then
619634
// applied to each of that parent segment's parallel route slots. In the
620635
// simple case where there's only one parallel route (the `children` slot),
@@ -647,6 +662,7 @@ export default function OuterLayoutRouter({
647662
cacheNode={cacheNode}
648663
segmentPath={segmentPath}
649664
/>
665+
{segmentBoundaryTriggerNode}
650666
</RedirectBoundary>
651667
</HTTPAccessFallbackBoundary>
652668
</LoadingBoundary>

packages/next/src/next-devtools/userspace/app/segment-explorer-node.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,19 @@ export function SegmentViewStateNode({ page }: { page: string }) {
7676
return null
7777
}
7878

79+
export function SegmentBoundaryTriggerNode() {
80+
const { boundaryType } = useSegmentState()
81+
let segmentNode: React.ReactNode = null
82+
if (boundaryType === 'loading') {
83+
segmentNode = <LoadingSegmentNode />
84+
} else if (boundaryType === 'not-found') {
85+
segmentNode = <NotFoundSegmentNode />
86+
} else if (boundaryType === 'error') {
87+
segmentNode = <ErrorSegmentNode />
88+
}
89+
return segmentNode
90+
}
91+
7992
export function SegmentViewNode({
8093
type,
8194
pagePath,
@@ -85,22 +98,9 @@ export function SegmentViewNode({
8598
pagePath: string
8699
children?: ReactNode
87100
}): React.ReactNode {
88-
const { boundaryType } = useSegmentState()
89-
90-
const isChildBoundary = type !== 'layout' && type !== 'template'
91-
92-
let segmentNode = (
101+
const segmentNode = (
93102
<SegmentTrieNode key={type} type={type} pagePath={pagePath} />
94103
)
95-
if (boundaryType && boundaryType !== type && isChildBoundary) {
96-
if (boundaryType === 'loading') {
97-
segmentNode = <LoadingSegmentNode />
98-
} else if (boundaryType === 'not-found') {
99-
segmentNode = <NotFoundSegmentNode />
100-
} else if (boundaryType === 'error') {
101-
segmentNode = <ErrorSegmentNode />
102-
}
103-
}
104104

105105
return (
106106
<>

0 commit comments

Comments
 (0)