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
afec9909
Unverified
Commit
afec9909
authored
Jul 18, 2025
by
Jiachi Liu
Committed by
GitHub
Jul 18, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[segment explorer] hide for pages router (#81813)
Hide the segment explorer menu item in pages router Closes NEXT-4635
parent
8a8888ca
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
41 deletions
+30
-41
segment-explorer.tsx
...ools/dev-overlay/components/overview/segment-explorer.tsx
+11
-25
panel-router.tsx
.../next/src/next-devtools/dev-overlay/menu/panel-router.tsx
+13
-12
segment-explorer.test.ts
...lopment/app-dir/segment-explorer/segment-explorer.test.ts
+2
-2
index.test.ts
test/development/client-dev-overlay/index.test.ts
+0
-2
playwright.ts
test/lib/browsers/playwright.ts
+4
-0
No files found.
packages/next/src/next-devtools/dev-overlay/components/overview/segment-explorer.tsx
View file @
afec9909
...
...
@@ -96,26 +96,18 @@ function SegmentExplorerFooter({
)
}
export
function
PageSegmentTree
({
isAppRouter
,
page
,
}:
{
isAppRouter
:
boolean
page
:
string
})
{
export
function
PageSegmentTree
({
page
}:
{
page
:
string
})
{
const
tree
=
useSegmentTree
()
// Count active boundaries for the badge
const
activeBoundariesCount
=
useMemo
(()
=>
{
return
isAppRouter
?
countActiveBoundaries
(
tree
)
:
0
},
[
tree
,
isAppRouter
])
return
countActiveBoundaries
(
tree
)
},
[
tree
])
// Global reset handler
const
handleGlobalReset
=
useCallback
(()
=>
{
if
(
isAppRouter
)
{
traverseTreeAndResetBoundaries
(
tree
)
}
},
[
tree
,
isAppRouter
])
traverseTreeAndResetBoundaries
(
tree
)
},
[
tree
])
return
(
<
div
...
...
@@ -126,7 +118,7 @@ export function PageSegmentTree({
height
:
'100%'
,
}
}
>
{
isAppRouter
&&
<
PageRouteBar
page=
{
page
}
/>
}
<
PageRouteBar
page=
{
page
}
/>
<
div
className=
"segment-explorer-content"
data
-
nextjs
-
devtool
-
segment
-
explorer
...
...
@@ -135,18 +127,12 @@ export function PageSegmentTree({
overflow
:
'auto'
,
}
}
>
{
isAppRouter
?
(
<
PageSegmentTreeLayerPresentation
node=
{
tree
}
level=
{
0
}
segment=
""
/>
)
:
(
<
p
>
Route Info currently is only available for the App Router.
</
p
>
)
}
<
PageSegmentTreeLayerPresentation
node=
{
tree
}
level=
{
0
}
segment=
""
/>
</
div
>
{
isAppRouter
&&
(
<
SegmentExplorerFooter
activeBoundariesCount=
{
activeBoundariesCount
}
onGlobalReset=
{
handleGlobalReset
}
/>
)
}
<
SegmentExplorerFooter
activeBoundariesCount=
{
activeBoundariesCount
}
onGlobalReset=
{
handleGlobalReset
}
/>
</
div
>
)
}
...
...
packages/next/src/next-devtools/dev-overlay/menu/panel-router.tsx
View file @
afec9909
...
...
@@ -34,6 +34,8 @@ const MenuPanel = () => {
const
{
setPanel
,
setSelectedIndex
}
=
usePanelRouterContext
()
const
{
state
,
dispatch
}
=
useDevOverlayContext
()
const
{
totalErrorCount
}
=
useRenderErrorContext
()
const
isAppRouter
=
state
.
routerType
===
'app'
return
(
<
DevtoolMenu
items=
{
[
...
...
@@ -82,14 +84,15 @@ const MenuPanel = () => {
value
:
<
ChevronRight
/>,
onClick
:
()
=>
setPanel
(
'turbo-info'
),
},
!!
process
.
env
.
__NEXT_DEVTOOL_SEGMENT_EXPLORER
&&
{
label
:
'Route Info'
,
value
:
<
ChevronRight
/>,
onClick
:
()
=>
setPanel
(
'segment-explorer'
),
attributes
:
{
'data-segment-explorer'
:
true
,
!!
process
.
env
.
__NEXT_DEVTOOL_SEGMENT_EXPLORER
&&
isAppRouter
&&
{
label
:
'Route Info'
,
value
:
<
ChevronRight
/>,
onClick
:
()
=>
setPanel
(
'segment-explorer'
),
attributes
:
{
'data-segment-explorer'
:
true
,
},
},
},
{
label
:
'Preferences'
,
value
:
<
GearIcon
/>,
...
...
@@ -137,6 +140,7 @@ export const PanelRouter = () => {
const
{
state
}
=
useDevOverlayContext
()
const
{
triggerRef
}
=
usePanelRouterContext
()
const
toggleDevtools
=
useToggleDevtoolsVisibility
()
const
isAppRouter
=
state
.
routerType
===
'app'
const
[
hideShortcut
,
setHideShortcut
]
=
useHideShortcutStorage
()
useShortcuts
(
...
...
@@ -206,7 +210,7 @@ export const PanelRouter = () => {
</
DynamicPanel
>
</
PanelRoute
>
{
process
.
env
.
__NEXT_DEVTOOL_SEGMENT_EXPLORER
&&
(
{
process
.
env
.
__NEXT_DEVTOOL_SEGMENT_EXPLORER
&&
isAppRouter
&&
(
<
PanelRoute
name=
"segment-explorer"
>
<
DynamicPanel
sharePanelSizeGlobally=
{
false
}
...
...
@@ -225,10 +229,7 @@ export const PanelRouter = () => {
}
}
header=
{
<
DevToolsHeader
title=
"Route Info"
/>
}
>
<
PageSegmentTree
isAppRouter=
{
state
.
routerType
===
'app'
}
page=
{
state
.
page
}
/>
<
PageSegmentTree
page=
{
state
.
page
}
/>
</
DynamicPanel
>
</
PanelRoute
>
)
}
...
...
test/development/app-dir/segment-explorer/segment-explorer.test.ts
View file @
afec9909
...
...
@@ -73,9 +73,9 @@ describe('segment-explorer', () => {
expect
(
await
getSegmentExplorerRoute
(
browser
)).
toBe
(
'/file-segments'
)
})
it
(
'should
indicate segment explorer is not available
for pages router'
,
async
()
=>
{
it
(
'should
not have route info panel
for pages router'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/pages-router'
)
expect
(
await
getSegmentExplorerContent
(
browser
)).
toMatchInlineSnapshot
(
`""`
)
expect
(
await
browser
.
hasElementByCss
(
'[data-segment-explorer]'
)).
toBe
(
false
)
})
it
(
'should handle special built-in not-found segments'
,
async
()
=>
{
...
...
test/development/client-dev-overlay/index.test.ts
View file @
afec9909
...
...
@@ -142,7 +142,6 @@ describe('client-dev-overlay', () => {
Static
Turbopack
Enabled
Route Info
Preferences"
`
)
}
else
{
...
...
@@ -152,7 +151,6 @@ describe('client-dev-overlay', () => {
Route
Static
Try Turbopack
Route Info
Preferences"
`
)
}
...
...
test/lib/browsers/playwright.ts
View file @
afec9909
...
...
@@ -375,6 +375,10 @@ export class Playwright<TCurrent = undefined> {
return
this
.
waitForElementByCss
(
selector
,
5
_000
)
}
hasElementByCss
(
selector
:
string
)
{
return
this
.
startChain
(()
=>
page
.
locator
(
selector
).
isVisible
())
}
elementById
(
id
:
string
)
{
return
this
.
elementByCss
(
`#
${
id
}
`
)
}
...
...
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