Skip to content

Commit d51caed

Browse files
committed
add getter helper
1 parent a74d641 commit d51caed

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

packages/next/src/next-devtools/dev-overlay/components/overview/segment-explorer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
import { Tooltip } from '../../../components/tooltip'
1212
import { useRef, useState } from 'react'
1313
import {
14-
BOUNDARY_PREFIX,
1514
BUILTIN_PREFIX,
15+
getBoundaryOriginFileType,
1616
isBoundaryFile,
1717
normalizeBoundaryFilename,
1818
} from '../../../../server/app-render/segment-explorer-path'
@@ -147,7 +147,7 @@ function PageSegmentTreeLayerPresentation({
147147
const childNode = node.children[childKey]
148148
if (!childNode || !childNode.value) return
149149
if (isBoundaryFile(childNode.value.type)) {
150-
const boundaryType = childNode.value.type.replace(BOUNDARY_PREFIX, '')
150+
const boundaryType = getBoundaryOriginFileType(childNode.value.type)
151151

152152
if (boundaryType in boundaries) {
153153
boundaries[boundaryType as keyof typeof boundaries] =

packages/next/src/server/app-render/create-component-tree.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ import type {
2626
UseCachePageComponentProps,
2727
} from '../use-cache/use-cache-wrapper'
2828
import { DEFAULT_SEGMENT_KEY } from '../../shared/lib/segment'
29-
import { getConventionPathByType } from './segment-explorer-path'
29+
import {
30+
BOUNDARY_PREFIX,
31+
getConventionPathByType,
32+
} from './segment-explorer-path'
3033

3134
/**
3235
* Use the provided loader tree to create the React Component tree.
@@ -567,19 +570,19 @@ async function createComponentTreeInternal({
567570
<>
568571
{notFoundFilePath && (
569572
<SegmentViewNode
570-
type={'boundary:not-found'}
573+
type={`${BOUNDARY_PREFIX}not-found`}
571574
pagePath={notFoundFilePath + fileNameSuffix}
572575
/>
573576
)}
574577
{loadingFilePath && (
575578
<SegmentViewNode
576-
type={'boundary:loading'}
579+
type={`${BOUNDARY_PREFIX}loading`}
577580
pagePath={loadingFilePath + fileNameSuffix}
578581
/>
579582
)}
580583
{errorFilePath && (
581584
<SegmentViewNode
582-
type={'boundary:error'}
585+
type={`${BOUNDARY_PREFIX}error`}
583586
pagePath={errorFilePath + fileNameSuffix}
584587
/>
585588
)}

packages/next/src/server/app-render/segment-explorer-path.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ export function isBoundaryFile(fileType: string) {
4242
return fileType.startsWith(BOUNDARY_PREFIX)
4343
}
4444

45+
export function getBoundaryOriginFileType(fileType: string) {
46+
return fileType.replace(BOUNDARY_PREFIX, '')
47+
}
48+
4549
export function getConventionPathByType(
4650
tree: LoaderTree,
4751
dir: string,

0 commit comments

Comments
 (0)