Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
212d0e7e
Unverified
Commit
212d0e7e
authored
Jun 24, 2025
by
Jiachi Liu
Committed by
GitHub
Jun 24, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[devtools] segment explorer tab (#80805)
parent
ba70eda3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
5 deletions
+45
-5
define-env.ts
packages/next/src/build/define-env.ts
+7
-3
devtools-panel-tab.tsx
.../devtools-panel/devtools-panel-tab/devtools-panel-tab.tsx
+4
-1
segments-explorer-tab.tsx
...vtools-panel/devtools-panel-tab/segments-explorer-tab.tsx
+30
-0
devtools-panel.tsx
.../dev-overlay/components/devtools-panel/devtools-panel.tsx
+1
-0
segment-explorer.tsx
...ools/dev-overlay/components/overview/segment-explorer.tsx
+1
-1
component-styles.tsx
...src/next-devtools/dev-overlay/styles/component-styles.tsx
+2
-0
No files found.
packages/next/src/build/define-env.ts
View file @
212d0e7e
...
...
@@ -107,6 +107,10 @@ export function getDefineEnv({
const
isDynamicIOEnabled
=
!!
config
.
experimental
.
dynamicIO
const
isUseCacheEnabled
=
!!
config
.
experimental
.
useCache
const
isDevToolPanelUIEnabled
=
!!
process
.
env
.
__NEXT_DEVTOOL_NEW_PANEL_UI
||
!!
config
.
experimental
.
devtoolNewPanelUI
const
defineEnv
:
DefineEnv
=
{
// internal field to identify the plugin config
__NEXT_DEFINE_ENV
:
true
,
...
...
@@ -297,9 +301,9 @@ export function getDefineEnv({
}
:
{}),
'process.env.__NEXT_DEVTOOL_SEGMENT_EXPLORER'
:
config
.
experimental
.
devtoolSegmentExplorer
??
false
,
'process.env.__NEXT_DEVTOOL_NEW_PANEL_UI'
:
config
.
experimental
.
devtoolNewPanelUI
??
false
,
// Enable segment explorer in devtools
isDevToolPanelUIEnabled
||
!!
config
.
experimental
.
devtoolSegmentExplorer
,
'process.env.__NEXT_DEVTOOL_NEW_PANEL_UI'
:
isDevToolPanelUIEnabled
,
// The devtools need to know whether or not to show an option to clear the
// bundler cache. This option may be removed later once Turbopack's
...
...
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/devtools-panel-tab.tsx
View file @
212d0e7e
...
...
@@ -6,11 +6,13 @@ import type { HydrationErrorState } from '../../../../shared/hydration-error'
import
{
SettingsTab
}
from
'./settings-tab'
import
{
IssuesTab
}
from
'./issues-tab/issues-tab'
import
{
SegmentsExplorerTab
}
from
'./segments-explorer-tab'
export
function
DevToolsPanelTab
({
activeTab
,
devToolsPosition
,
scale
,
routerType
,
handlePositionChange
,
handleScaleChange
,
debugInfo
,
...
...
@@ -20,6 +22,7 @@ export function DevToolsPanelTab({
}:
{
activeTab
:
DevToolsPanelTabType
devToolsPosition
:
Corners
routerType
:
'app'
|
'pages'
scale
:
number
handlePositionChange
:
(
e
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
void
handleScaleChange
:
(
e
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
void
...
...
@@ -39,7 +42,7 @@ export function DevToolsPanelTab({
/>
)
case
'route'
:
return
<
div
>
Route
</
div
>
return
<
SegmentsExplorerTab
routerType=
{
routerType
}
/
>
case
'issues'
:
return
(
<
IssuesTab
...
...
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/segments-explorer-tab.tsx
0 → 100644
View file @
212d0e7e
import
{
useSegmentTree
}
from
'../../../segment-explorer'
import
{
PageSegmentTree
}
from
'../../overview/segment-explorer'
function
SegmentsExplorer
({
routerType
,
}:
React
.
HTMLProps
<
HTMLDivElement
>
&
{
routerType
:
'app'
|
'pages'
})
{
const
tree
=
useSegmentTree
()
const
isAppRouter
=
routerType
===
'app'
return
<
PageSegmentTree
tree=
{
tree
}
isAppRouter=
{
isAppRouter
}
/>
}
export
function
SegmentsExplorerTab
({
routerType
,
}:
{
routerType
:
'app'
|
'pages'
})
{
return
(
<
div
data
-
nextjs
-
devtools
-
panel
-
segments
-
explorer
>
<
SegmentsExplorer
routerType=
{
routerType
}
/>
</
div
>
)
}
export
const
SEGMENTS_EXPLORER_TAB_STYLES
=
`
[data-nextjs-devtools-panel-segments-explorer] {
padding: 0 8px;
}
`
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel.tsx
View file @
212d0e7e
...
...
@@ -163,6 +163,7 @@ export function DevToolsPanel({
activeTab=
{
activeTab
}
devToolsPosition=
{
state
.
devToolsPosition
}
scale=
{
state
.
scale
}
routerType=
{
state
.
routerType
}
handlePositionChange=
{
handlePositionChange
}
handleScaleChange=
{
handleScaleChange
}
debugInfo=
{
state
.
debugInfo
}
...
...
packages/next/src/next-devtools/dev-overlay/components/overview/segment-explorer.tsx
View file @
212d0e7e
...
...
@@ -9,7 +9,7 @@ const isFileNode = (node: SegmentTrieNode) => {
return
!!
node
.
value
?.
type
&&
!!
node
.
value
?.
pagePath
}
function
PageSegmentTree
({
export
function
PageSegmentTree
({
tree
,
isAppRouter
,
}:
{
...
...
packages/next/src/next-devtools/dev-overlay/styles/component-styles.tsx
View file @
212d0e7e
...
...
@@ -35,6 +35,7 @@ import { DEVTOOLS_PANEL_TAB_ISSUES_SIDEBAR_FRAME_SKELETON_STYLES } from '../comp
import
{
DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-content'
import
{
ISSUE_FEEDBACK_BUTTON_STYLES
}
from
'../components/errors/error-overlay-toolbar/issue-feedback-button'
import
{
ERROR_CONTENT_SKELETON_STYLES
}
from
'../container/runtime-error/error-content-skeleton'
import
{
SEGMENTS_EXPLORER_TAB_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/segments-explorer-tab'
export
function
ComponentStyles
()
{
return
(
...
...
@@ -76,6 +77,7 @@ export function ComponentStyles() {
${DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_STYLES}
${ISSUE_FEEDBACK_BUTTON_STYLES}
${ERROR_CONTENT_SKELETON_STYLES}
${SEGMENTS_EXPLORER_TAB_STYLES}
`
}
</
style
>
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment