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
13401d8f
Unverified
Commit
13401d8f
authored
Jul 01, 2025
by
Jiachi Liu
Committed by
GitHub
Jul 01, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[devtool] merge segment explorer flag into panel ui flag (#81085)
parent
6f0225a0
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
50 additions
and
91 deletions
+50
-91
next_config.rs
crates/next-core/src/next_config.rs
+3
-2
define-env.ts
packages/next/src/build/define-env.ts
+0
-3
app-page.ts
packages/next/src/build/templates/app-page.ts
+1
-2
render.ts
.../src/build/webpack/loaders/next-edge-ssr-loader/render.ts
+1
-1
devtools-indicator.tsx
...rlay/components/devtools-indicator/devtools-indicator.tsx
+1
-1
devtools-panel.tsx
.../dev-overlay/components/devtools-panel/devtools-panel.tsx
+7
-4
dev-tools-indicator.tsx
...onents/errors/dev-tools-indicator/dev-tools-indicator.tsx
+3
-26
segments-explorer.tsx
.../dev-tools-indicator/dev-tools-info/segments-explorer.tsx
+0
-27
component-styles.tsx
...src/next-devtools/dev-overlay/styles/component-styles.tsx
+0
-2
app-render.tsx
packages/next/src/server/app-render/app-render.tsx
+1
-1
create-component-tree.tsx
...ages/next/src/server/app-render/create-component-tree.tsx
+2
-4
types.ts
packages/next/src/server/app-render/types.ts
+2
-2
base-server.ts
packages/next/src/server/base-server.ts
+1
-2
config-schema.ts
packages/next/src/server/config-schema.ts
+0
-1
config-shared.ts
packages/next/src/server/config-shared.ts
+0
-6
next.config.js
...velopment/app-dir/segment-explorer-globals/next.config.js
+1
-1
segment-explorer-globals.test.ts
...segment-explorer-globals/segment-explorer-globals.test.ts
+4
-3
next.config.js
test/development/app-dir/segment-explorer/next.config.js
+1
-1
segment-explorer.test.ts
...lopment/app-dir/segment-explorer/segment-explorer.test.ts
+5
-2
next-test-utils.ts
test/lib/next-test-utils.ts
+17
-0
No files found.
crates/next-core/src/next_config.rs
View file @
13401d8f
...
@@ -801,8 +801,9 @@ pub struct ExperimentalConfig {
...
@@ -801,8 +801,9 @@ pub struct ExperimentalConfig {
global_not_found
:
Option
<
bool
>
,
global_not_found
:
Option
<
bool
>
,
/// Defaults to false in development mode, true in production mode.
/// Defaults to false in development mode, true in production mode.
turbopack_remove_unused_exports
:
Option
<
bool
>
,
turbopack_remove_unused_exports
:
Option
<
bool
>
,
/// Devtool option for the segment explorer.
/// Devtool option for new panel UI.
devtool_segment_explorer
:
Option
<
bool
>
,
#[serde(rename
=
"devtoolNewPanelUI"
)]
devtool_new_panel_ui
:
Option
<
bool
>
,
}
}
#[derive(
#[derive(
...
...
packages/next/src/build/define-env.ts
View file @
13401d8f
...
@@ -298,9 +298,6 @@ export function getDefineEnv({
...
@@ -298,9 +298,6 @@ export function getDefineEnv({
),
),
}
}
:
{}),
:
{}),
'process.env.__NEXT_DEVTOOL_SEGMENT_EXPLORER'
:
// Enable segment explorer in devtools
isDevToolPanelUIEnabled
||
!!
config
.
experimental
.
devtoolSegmentExplorer
,
'process.env.__NEXT_DEVTOOL_NEW_PANEL_UI'
:
isDevToolPanelUIEnabled
,
'process.env.__NEXT_DEVTOOL_NEW_PANEL_UI'
:
isDevToolPanelUIEnabled
,
// The devtools need to know whether or not to show an option to clear the
// The devtools need to know whether or not to show an option to clear the
...
...
packages/next/src/build/templates/app-page.ts
View file @
13401d8f
...
@@ -484,8 +484,7 @@ export async function handler(
...
@@ -484,8 +484,7 @@ export async function handler(
deploymentId
:
nextConfig
.
deploymentId
,
deploymentId
:
nextConfig
.
deploymentId
,
enableTainting
:
nextConfig
.
experimental
.
taint
,
enableTainting
:
nextConfig
.
experimental
.
taint
,
htmlLimitedBots
:
nextConfig
.
htmlLimitedBots
,
htmlLimitedBots
:
nextConfig
.
htmlLimitedBots
,
devtoolSegmentExplorer
:
devtoolNewPanelUI
:
nextConfig
.
experimental
.
devtoolNewPanelUI
,
nextConfig
.
experimental
.
devtoolSegmentExplorer
,
reactMaxHeadersLength
:
nextConfig
.
reactMaxHeadersLength
,
reactMaxHeadersLength
:
nextConfig
.
reactMaxHeadersLength
,
multiZoneDraftMode
,
multiZoneDraftMode
,
...
...
packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts
View file @
13401d8f
...
@@ -100,7 +100,7 @@ export function getRender({
...
@@ -100,7 +100,7 @@ export function getRender({
serverActionsManifest
,
serverActionsManifest
,
serverActions
,
serverActions
,
nextFontManifest
,
nextFontManifest
,
devtool
SegmentExplorer
:
config
.
experimental
.
devtoolSegmentExplorer
,
devtool
NewPanelUI
:
config
.
experimental
.
devtoolNewPanelUI
,
},
},
renderToHTML
,
renderToHTML
,
incrementalCacheHandler
,
incrementalCacheHandler
,
...
...
packages/next/src/next-devtools/dev-overlay/components/devtools-indicator/devtools-indicator.tsx
View file @
13401d8f
...
@@ -56,7 +56,7 @@ export function DevToolsIndicator({
...
@@ -56,7 +56,7 @@ export function DevToolsIndicator({
[
vertical
]:
`${INDICATOR_PADDING}px`
,
[
vertical
]:
`${INDICATOR_PADDING}px`
,
[
horizontal
]:
`${INDICATOR_PADDING}px`
,
[
horizontal
]:
`${INDICATOR_PADDING}px`
,
visibility
:
visibility
:
state
.
isDevToolsPanelOpen
||
state
.
isErrorOverlayOpen
state
.
isDevToolsPanelOpen
&&
!
state
.
isErrorOverlayOpen
?
'hidden'
?
'hidden'
:
'visible'
,
:
'visible'
,
}
as
CSSProperties
}
as
CSSProperties
...
...
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel.tsx
View file @
13401d8f
...
@@ -161,7 +161,8 @@ export function DevToolsPanel({
...
@@ -161,7 +161,8 @@ export function DevToolsPanel({
>
>
<
div
data
-
nextjs
-
devtools
-
panel
-
header
-
tab
-
group
>
<
div
data
-
nextjs
-
devtools
-
panel
-
header
-
tab
-
group
>
<
button
<
button
data
-
nextjs
-
devtools
-
panel
-
header
-
tab=
{
data
-
nextjs
-
devtools
-
panel
-
header
-
tab=
"issues"
data
-
nextjs
-
devtools
-
panel
-
header
-
tab
-
active=
{
activeTab
===
'issues'
activeTab
===
'issues'
}
}
onClick=
{
()
=>
setActiveTab
(
'issues'
)
}
onClick=
{
()
=>
setActiveTab
(
'issues'
)
}
...
@@ -176,7 +177,8 @@ export function DevToolsPanel({
...
@@ -176,7 +177,8 @@ export function DevToolsPanel({
)
:
null
}
)
:
null
}
</
button
>
</
button
>
<
button
<
button
data
-
nextjs
-
devtools
-
panel
-
header
-
tab=
{
data
-
nextjs
-
devtools
-
panel
-
header
-
tab=
"route"
data
-
nextjs
-
devtools
-
panel
-
header
-
tab
-
active=
{
activeTab
===
'route'
activeTab
===
'route'
}
}
onClick=
{
()
=>
setActiveTab
(
'route'
)
}
onClick=
{
()
=>
setActiveTab
(
'route'
)
}
...
@@ -184,7 +186,8 @@ export function DevToolsPanel({
...
@@ -184,7 +186,8 @@ export function DevToolsPanel({
Route Info
Route Info
</
button
>
</
button
>
<
button
<
button
data
-
nextjs
-
devtools
-
panel
-
header
-
tab=
{
data
-
nextjs
-
devtools
-
panel
-
header
-
tab=
"settings"
data
-
nextjs
-
devtools
-
panel
-
header
-
tab
-
active=
{
activeTab
===
'settings'
activeTab
===
'settings'
}
}
onClick=
{
()
=>
setActiveTab
(
'settings'
)
}
onClick=
{
()
=>
setActiveTab
(
'settings'
)
}
...
@@ -352,7 +355,7 @@ export const DEVTOOLS_PANEL_STYLES = css`
...
@@ -352,7 +355,7 @@ export const DEVTOOLS_PANEL_STYLES = css`
}
}
}
}
[data-nextjs-devtools-panel-header-tab='true'] {
[data-nextjs-devtools-panel-header-tab
-active
='true'] {
color: var(--color-gray-1000);
color: var(--color-gray-1000);
background-color: var(--color-gray-100);
background-color: var(--color-gray-100);
}
}
...
...
packages/next/src/next-devtools/dev-overlay/components/errors/dev-tools-indicator/dev-tools-indicator.tsx
View file @
13401d8f
...
@@ -26,7 +26,6 @@ import {
...
@@ -26,7 +26,6 @@ import {
type
DevToolsScale
,
type
DevToolsScale
,
}
from
'./dev-tools-info/preferences'
}
from
'./dev-tools-info/preferences'
import
{
Draggable
}
from
'./draggable'
import
{
Draggable
}
from
'./draggable'
import
{
SegmentsExplorer
}
from
'./dev-tools-info/segments-explorer'
// TODO: add E2E tests to cover different scenarios
// TODO: add E2E tests to cover different scenarios
...
@@ -84,7 +83,6 @@ const OVERLAYS = {
...
@@ -84,7 +83,6 @@ const OVERLAYS = {
Turbo
:
'turbo'
,
Turbo
:
'turbo'
,
Route
:
'route'
,
Route
:
'route'
,
Preferences
:
'preferences'
,
Preferences
:
'preferences'
,
SegmentExplorer
:
'segment-explorer'
,
}
as
const
}
as
const
export
type
Overlays
=
(
typeof
OVERLAYS
)[
keyof
typeof
OVERLAYS
]
export
type
Overlays
=
(
typeof
OVERLAYS
)[
keyof
typeof
OVERLAYS
]
...
@@ -130,7 +128,6 @@ function DevToolsPopover({
...
@@ -130,7 +128,6 @@ function DevToolsPopover({
const
isTurbopackInfoOpen
=
open
===
OVERLAYS
.
Turbo
const
isTurbopackInfoOpen
=
open
===
OVERLAYS
.
Turbo
const
isRouteInfoOpen
=
open
===
OVERLAYS
.
Route
const
isRouteInfoOpen
=
open
===
OVERLAYS
.
Route
const
isPreferencesOpen
=
open
===
OVERLAYS
.
Preferences
const
isPreferencesOpen
=
open
===
OVERLAYS
.
Preferences
const
isSegmentExplorerOpen
=
open
===
OVERLAYS
.
SegmentExplorer
const
{
mounted
:
menuMounted
,
rendered
:
menuRendered
}
=
useDelayedRender
(
const
{
mounted
:
menuMounted
,
rendered
:
menuRendered
}
=
useDelayedRender
(
isMenuOpen
,
isMenuOpen
,
...
@@ -220,8 +217,10 @@ function DevToolsPopover({
...
@@ -220,8 +217,10 @@ function DevToolsPopover({
}
}
function
toggleErrorOverlay
()
{
function
toggleErrorOverlay
()
{
if
(
!
process
.
env
.
__NEXT_DEVTOOL_NEW_PANEL_UI
)
{
dispatch
({
type
:
ACTION_ERROR_OVERLAY_TOGGLE
})
dispatch
({
type
:
ACTION_ERROR_OVERLAY_TOGGLE
})
}
}
}
function
closeToRootMenu
()
{
function
closeToRootMenu
()
{
setOpen
(
OVERLAYS
.
Root
)
setOpen
(
OVERLAYS
.
Root
)
...
@@ -336,19 +335,6 @@ function DevToolsPopover({
...
@@ -336,19 +335,6 @@ function DevToolsPopover({
setScale=
{
setScale
}
setScale=
{
setScale
}
/>
/>
{
/* Page Route Info */
}
{
process
.
env
.
__NEXT_DEVTOOL_SEGMENT_EXPLORER
?
(
<
SegmentsExplorer
isOpen=
{
isSegmentExplorerOpen
}
close=
{
closeToRootMenu
}
triggerRef=
{
triggerRef
}
style=
{
popover
}
routerType=
{
routerType
}
// dummy page for legacy segment explorer, will be removed in the future
page=
{
''
}
/>
)
:
null
}
{
/* Dropdown Menu */
}
{
/* Dropdown Menu */
}
{
menuMounted
&&
(
{
menuMounted
&&
(
<
div
<
div
...
@@ -414,15 +400,6 @@ function DevToolsPopover({
...
@@ -414,15 +400,6 @@ function DevToolsPopover({
onClick=
{
()
=>
setOpen
(
OVERLAYS
.
Preferences
)
}
onClick=
{
()
=>
setOpen
(
OVERLAYS
.
Preferences
)
}
index=
{
isTurbopack
?
2
:
3
}
index=
{
isTurbopack
?
2
:
3
}
/>
/>
{
process
.
env
.
__NEXT_DEVTOOL_SEGMENT_EXPLORER
?
(
<
MenuItem
data
-
segment
-
explorer
label=
"Route Info"
value=
{
<
ChevronRight
/>
}
onClick=
{
()
=>
setOpen
(
OVERLAYS
.
SegmentExplorer
)
}
index=
{
isTurbopack
?
3
:
4
}
/>
)
:
null
}
</
div
>
</
div
>
</
Context
.
Provider
>
</
Context
.
Provider
>
</
div
>
</
div
>
...
...
packages/next/src/next-devtools/dev-overlay/components/errors/dev-tools-indicator/dev-tools-info/segments-explorer.tsx
deleted
100644 → 0
View file @
6f0225a0
import
{
PageSegmentTree
}
from
'../../../overview/segment-explorer'
import
{
DevToolsInfo
,
type
DevToolsInfoPropsCore
}
from
'./dev-tools-info'
export
function
SegmentsExplorer
({
routerType
,
page
,
...
props
}:
DevToolsInfoPropsCore
&
React
.
HTMLProps
<
HTMLDivElement
>
&
{
routerType
:
'app'
|
'pages'
page
:
string
})
{
const
isAppRouter
=
routerType
===
'app'
return
(
<
DevToolsInfo
title=
"Route Info"
{
...
props
}
>
<
div
data
-
nextjs
-
segments
-
explorer
>
<
PageSegmentTree
isAppRouter=
{
isAppRouter
}
page=
{
page
}
/>
</
div
>
</
DevToolsInfo
>
)
}
export
const
SEGMENTS_EXPLORER_STYLES
=
`
[data-nextjs-segments-explorer] {
margin: -12px -8px;
}
`
packages/next/src/next-devtools/dev-overlay/styles/component-styles.tsx
View file @
13401d8f
...
@@ -36,7 +36,6 @@ import { DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_STYLES } from '../components/devtools
...
@@ -36,7 +36,6 @@ import { DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_STYLES } from '../components/devtools
import
{
ISSUE_FEEDBACK_BUTTON_STYLES
}
from
'../components/errors/error-overlay-toolbar/issue-feedback-button'
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
{
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'
import
{
SEGMENTS_EXPLORER_TAB_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/segments-explorer-tab'
import
{
SEGMENTS_EXPLORER_STYLES
}
from
'../components/errors/dev-tools-indicator/dev-tools-info/segments-explorer'
import
{
DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_LAYOUT_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-content-layout'
import
{
DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_LAYOUT_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-content-layout'
import
{
DEVTOOLS_PANEL_TAB_ISSUES_EMPTY_CONTENT_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-empty-content'
import
{
DEVTOOLS_PANEL_TAB_ISSUES_EMPTY_CONTENT_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-empty-content'
...
@@ -68,7 +67,6 @@ export function ComponentStyles() {
...
@@ -68,7 +67,6 @@ export function ComponentStyles() {
${DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES}
${DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES}
${DEV_TOOLS_INFO_ROUTE_INFO_STYLES}
${DEV_TOOLS_INFO_ROUTE_INFO_STYLES}
${DEV_TOOLS_INFO_USER_PREFERENCES_STYLES}
${DEV_TOOLS_INFO_USER_PREFERENCES_STYLES}
${SEGMENTS_EXPLORER_STYLES}
${DEV_TOOLS_INFO_RENDER_FILES_STYLES}
${DEV_TOOLS_INFO_RENDER_FILES_STYLES}
${FADER_STYLES}
${FADER_STYLES}
${DEVTOOLS_PANEL_STYLES}
${DEVTOOLS_PANEL_STYLES}
...
...
packages/next/src/server/app-render/app-render.tsx
View file @
13401d8f
...
@@ -3977,7 +3977,7 @@ const getGlobalErrorStyles = async (
...
@@ -3977,7 +3977,7 @@ const getGlobalErrorStyles = async (
dir
,
dir
,
globalErrorModule
?.[
1
]
globalErrorModule
?.[
1
]
)
)
if
(
ctx
.
renderOpts
.
devtool
SegmentExplorer
&&
globalErrorModulePath
)
{
if
(
ctx
.
renderOpts
.
devtool
NewPanelUI
&&
globalErrorModulePath
)
{
const
SegmentViewNode
=
ctx
.
componentMod
.
SegmentViewNode
const
SegmentViewNode
=
ctx
.
componentMod
.
SegmentViewNode
globalErrorStyles
=
(
globalErrorStyles
=
(
// This will be rendered next to GlobalError component under ErrorBoundary,
// This will be rendered next to GlobalError component under ErrorBoundary,
...
...
packages/next/src/server/app-render/create-component-tree.tsx
View file @
13401d8f
...
@@ -396,8 +396,7 @@ async function createComponentTreeInternal({
...
@@ -396,8 +396,7 @@ async function createComponentTreeInternal({
// Resolve the segment param
// Resolve the segment param
const
actualSegment
=
segmentParam
?
segmentParam
.
treeSegment
:
segment
const
actualSegment
=
segmentParam
?
segmentParam
.
treeSegment
:
segment
const
isSegmentViewEnabled
=
const
isSegmentViewEnabled
=
process
.
env
.
NODE_ENV
===
'development'
&&
process
.
env
.
NODE_ENV
===
'development'
&&
ctx
.
renderOpts
.
devtoolNewPanelUI
ctx
.
renderOpts
.
devtoolSegmentExplorer
const
dir
=
const
dir
=
process
.
env
.
NEXT_RUNTIME
===
'edge'
process
.
env
.
NEXT_RUNTIME
===
'edge'
?
process
.
env
.
__NEXT_EDGE_PROJECT_DIR
!
?
process
.
env
.
__NEXT_EDGE_PROJECT_DIR
!
...
@@ -1084,8 +1083,7 @@ async function createBoundaryConventionElement({
...
@@ -1084,8 +1083,7 @@ async function createBoundaryConventionElement({
tree
:
LoaderTree
tree
:
LoaderTree
})
{
})
{
const
isSegmentViewEnabled
=
const
isSegmentViewEnabled
=
process
.
env
.
NODE_ENV
===
'development'
&&
process
.
env
.
NODE_ENV
===
'development'
&&
ctx
.
renderOpts
.
devtoolNewPanelUI
ctx
.
renderOpts
.
devtoolSegmentExplorer
const
dir
=
const
dir
=
process
.
env
.
NEXT_RUNTIME
===
'edge'
process
.
env
.
NEXT_RUNTIME
===
'edge'
?
process
.
env
.
__NEXT_EDGE_PROJECT_DIR
!
?
process
.
env
.
__NEXT_EDGE_PROJECT_DIR
!
...
...
packages/next/src/server/app-render/types.ts
View file @
13401d8f
...
@@ -280,9 +280,9 @@ export interface RenderOptsPartial {
...
@@ -280,9 +280,9 @@ export interface RenderOptsPartial {
allowEmptyStaticShell
?:
boolean
allowEmptyStaticShell
?:
boolean
/**
/**
* next config experimental.devtool
SegmentExplorer
* next config experimental.devtool
NewPanelUI
*/
*/
devtool
SegmentExplorer
?:
boolean
devtool
NewPanelUI
?:
boolean
}
}
export
type
RenderOpts
=
LoadComponentsReturnType
<
AppPageModule
>
&
export
type
RenderOpts
=
LoadComponentsReturnType
<
AppPageModule
>
&
...
...
packages/next/src/server/base-server.ts
View file @
13401d8f
...
@@ -612,8 +612,7 @@ export default abstract class Server<
...
@@ -612,8 +612,7 @@ export default abstract class Server<
onInstrumentationRequestError
:
onInstrumentationRequestError
:
this
.
instrumentationOnRequestError
.
bind
(
this
),
this
.
instrumentationOnRequestError
.
bind
(
this
),
reactMaxHeadersLength
:
this
.
nextConfig
.
reactMaxHeadersLength
,
reactMaxHeadersLength
:
this
.
nextConfig
.
reactMaxHeadersLength
,
devtoolSegmentExplorer
:
devtoolNewPanelUI
:
this
.
nextConfig
.
experimental
.
devtoolNewPanelUI
,
this
.
nextConfig
.
experimental
.
devtoolSegmentExplorer
,
}
}
// Initialize next/config with the environment configuration
// Initialize next/config with the environment configuration
...
...
packages/next/src/server/config-schema.ts
View file @
13401d8f
...
@@ -500,7 +500,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
...
@@ -500,7 +500,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
})
})
.
optional
(),
.
optional
(),
globalNotFound
:
z
.
boolean
().
optional
(),
globalNotFound
:
z
.
boolean
().
optional
(),
devtoolSegmentExplorer
:
z
.
boolean
().
optional
(),
devtoolNewPanelUI
:
z
.
boolean
().
optional
(),
devtoolNewPanelUI
:
z
.
boolean
().
optional
(),
})
})
.
optional
(),
.
optional
(),
...
...
packages/next/src/server/config-shared.ts
View file @
13401d8f
...
@@ -736,11 +736,6 @@ export interface ExperimentalConfig {
...
@@ -736,11 +736,6 @@ export interface ExperimentalConfig {
*/
*/
globalNotFound
?:
boolean
globalNotFound
?:
boolean
/**
* Enable segment viewer for the app directory in Next.js DevTools.
*/
devtoolSegmentExplorer
?:
boolean
/**
/**
* Enable new panel UI for the Next.js DevTools.
* Enable new panel UI for the Next.js DevTools.
*/
*/
...
@@ -1456,7 +1451,6 @@ export const defaultConfig = {
...
@@ -1456,7 +1451,6 @@ export const defaultConfig = {
useCache
:
undefined
,
useCache
:
undefined
,
slowModuleDetection
:
undefined
,
slowModuleDetection
:
undefined
,
globalNotFound
:
false
,
globalNotFound
:
false
,
devtoolSegmentExplorer
:
false
,
},
},
htmlLimitedBots
:
undefined
,
htmlLimitedBots
:
undefined
,
bundlePagesRouterDependencies
:
false
,
bundlePagesRouterDependencies
:
false
,
...
...
test/development/app-dir/segment-explorer-globals/next.config.js
View file @
13401d8f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*/
*/
const
nextConfig
=
{
const
nextConfig
=
{
experimental
:
{
experimental
:
{
devtool
SegmentExplorer
:
true
,
devtool
NewPanelUI
:
true
,
authInterrupts
:
true
,
authInterrupts
:
true
,
globalNotFound
:
true
,
globalNotFound
:
true
,
},
},
...
...
test/development/app-dir/segment-explorer-globals/segment-explorer-globals.test.ts
View file @
13401d8f
...
@@ -3,11 +3,12 @@ import { openDevToolsIndicatorPopover } from 'next-test-utils'
...
@@ -3,11 +3,12 @@ import { openDevToolsIndicatorPopover } from 'next-test-utils'
import
{
Playwright
}
from
'next-webdriver'
import
{
Playwright
}
from
'next-webdriver'
async
function
getSegmentExplorerContent
(
browser
:
Playwright
)
{
async
function
getSegmentExplorerContent
(
browser
:
Playwright
)
{
// open the devtool button
await
openDevToolsIndicatorPopover
(
browser
)
await
openDevToolsIndicatorPopover
(
browser
)
// open the segment explorer
// open segment explorer tab
await
browser
.
elementByCss
(
'[data-segment-explorer]'
).
click
()
await
browser
.
elementByCss
(
'[data-nextjs-devtools-panel-header-tab="route"]'
)
.
click
()
// wait for the segment explorer to be visible
// wait for the segment explorer to be visible
await
browser
.
waitForElementByCss
(
'[data-nextjs-devtool-segment-explorer]'
)
await
browser
.
waitForElementByCss
(
'[data-nextjs-devtool-segment-explorer]'
)
...
...
test/development/app-dir/segment-explorer/next.config.js
View file @
13401d8f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*/
*/
const
nextConfig
=
{
const
nextConfig
=
{
experimental
:
{
experimental
:
{
devtool
SegmentExplorer
:
true
,
devtool
NewPanelUI
:
true
,
authInterrupts
:
true
,
authInterrupts
:
true
,
},
},
}
}
...
...
test/development/app-dir/segment-explorer/segment-explorer.test.ts
View file @
13401d8f
...
@@ -6,8 +6,10 @@ async function getSegmentExplorerContent(browser: Playwright) {
...
@@ -6,8 +6,10 @@ async function getSegmentExplorerContent(browser: Playwright) {
// open the devtool button
// open the devtool button
await
openDevToolsIndicatorPopover
(
browser
)
await
openDevToolsIndicatorPopover
(
browser
)
// open the segment explorer
// open segment explorer tab
await
browser
.
elementByCss
(
'[data-segment-explorer]'
).
click
()
await
browser
.
elementByCss
(
'[data-nextjs-devtools-panel-header-tab="route"]'
)
.
click
()
// wait for the segment explorer to be visible
// wait for the segment explorer to be visible
await
browser
.
waitForElementByCss
(
'[data-nextjs-devtool-segment-explorer]'
)
await
browser
.
waitForElementByCss
(
'[data-nextjs-devtool-segment-explorer]'
)
...
@@ -86,6 +88,7 @@ describe('segment-explorer', () => {
...
@@ -86,6 +88,7 @@ describe('segment-explorer', () => {
await
browser
.
elementByCss
(
'[href="/soft-navigation/b"]'
).
click
()
await
browser
.
elementByCss
(
'[href="/soft-navigation/b"]'
).
click
()
await
retry
(
async
()
=>
{
await
retry
(
async
()
=>
{
expect
(
await
browser
.
elementByCss
(
'body'
).
text
()).
toContain
(
'Page B'
)
expect
(
await
browser
.
elementByCss
(
'body'
).
text
()).
toContain
(
'Page B'
)
expect
(
await
browser
.
url
()).
toBe
(
`
${
next
.
url
}
/soft-navigation/b`
)
})
})
expect
(
await
getSegmentExplorerContent
(
browser
)).
toMatchInlineSnapshot
(
`
expect
(
await
getSegmentExplorerContent
(
browser
)).
toMatchInlineSnapshot
(
`
...
...
test/lib/next-test-utils.ts
View file @
13401d8f
...
@@ -951,6 +951,11 @@ export async function openRedbox(browser: Playwright): Promise<void> {
...
@@ -951,6 +951,11 @@ export async function openRedbox(browser: Playwright): Promise<void> {
export
async
function
openDevToolsIndicatorPopover
(
export
async
function
openDevToolsIndicatorPopover
(
browser
:
Playwright
browser
:
Playwright
):
Promise
<
void
>
{
):
Promise
<
void
>
{
// If the devtools panel is already open, we don't assert the indicator,
// and no need to open it again.
if
(
await
hasDevToolsPanel
(
browser
))
{
return
}
const
devToolsIndicator
=
await
assertHasDevToolsIndicator
(
browser
)
const
devToolsIndicator
=
await
assertHasDevToolsIndicator
(
browser
)
try
{
try
{
...
@@ -962,6 +967,18 @@ export async function openDevToolsIndicatorPopover(
...
@@ -962,6 +967,18 @@ export async function openDevToolsIndicatorPopover(
}
}
}
}
export
async
function
hasDevToolsPanel
(
browser
:
Playwright
)
{
const
result
=
await
browser
.
eval
(()
=>
{
const
portal
=
[].
slice
.
call
(
document
.
querySelectorAll
(
'nextjs-portal'
))
.
find
((
p
)
=>
p
.
shadowRoot
.
querySelector
(
'[data-nextjs-dialog-overlay]'
))
const
root
=
portal
?.
shadowRoot
return
root
?.
querySelector
(
'[data-nextjs-dialog-overlay]'
)
!=
null
})
return
result
}
export
async
function
assertHasDevToolsIndicator
(
browser
:
Playwright
)
{
export
async
function
assertHasDevToolsIndicator
(
browser
:
Playwright
)
{
const
devToolsIndicator
=
browser
.
locateDevToolsIndicator
()
const
devToolsIndicator
=
browser
.
locateDevToolsIndicator
()
try
{
try
{
...
...
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