@@ -10,8 +10,12 @@ import {
10
10
} from './segment-boundary-trigger'
11
11
import { Tooltip } from '../../../components/tooltip'
12
12
import { useRef , useState } from 'react'
13
-
14
- const BUILTIN_PREFIX = '__next_builtin__'
13
+ import {
14
+ BOUNDARY_PREFIX ,
15
+ BUILTIN_PREFIX ,
16
+ isBoundaryFile ,
17
+ normalizeBoundaryFilename ,
18
+ } from '../../../../server/app-render/segment-explorer-path'
15
19
16
20
const isFileNode = ( node : SegmentTrieNode ) => {
17
21
return ! ! node . value ?. type && ! ! node . value ?. pagePath
@@ -142,12 +146,13 @@ function PageSegmentTreeLayerPresentation({
142
146
filesChildrenKeys . forEach ( ( childKey ) => {
143
147
const childNode = node . children [ childKey ]
144
148
if ( ! childNode || ! childNode . value ) return
145
- if ( childNode . value . type . startsWith ( 'boundary:' ) ) {
146
- const boundaryType = childNode . value . type . split ( ':' ) [ 1 ] as
147
- | 'not-found'
148
- | 'loading'
149
- | 'error'
150
- boundaries [ boundaryType ] = childNode . value . pagePath || null
149
+ if ( isBoundaryFile ( childNode . value . type ) ) {
150
+ const boundaryType = childNode . value . type . replace ( BOUNDARY_PREFIX , '' )
151
+
152
+ if ( boundaryType in boundaries ) {
153
+ boundaries [ boundaryType as keyof typeof boundaries ] =
154
+ childNode . value . pagePath || null
155
+ }
151
156
}
152
157
} )
153
158
@@ -184,13 +189,13 @@ function PageSegmentTreeLayerPresentation({
184
189
}
185
190
// If it's boundary node, which marks the existence of the boundary not the rendered status,
186
191
// we don't need to present in the rendered files.
187
- if ( childNode . value . type . startsWith ( 'boundary:' ) ) {
192
+ if ( isBoundaryFile ( childNode . value . type ) ) {
188
193
return null
189
194
}
190
195
const filePath = childNode . value . pagePath
191
196
const lastSegment = filePath . split ( '/' ) . pop ( ) || ''
192
197
const isBuiltin = filePath . startsWith ( BUILTIN_PREFIX )
193
- const fileName = lastSegment . replace ( BUILTIN_PREFIX , '' )
198
+ const fileName = normalizeBoundaryFilename ( lastSegment )
194
199
195
200
return (
196
201
< span
0 commit comments