Skip to content

Commit b8b653b

Browse files
authored
Clean up unused code in restart server button (#82409)
1 parent 1779eb0 commit b8b653b

File tree

7 files changed

+3
-164
lines changed

7 files changed

+3
-164
lines changed

packages/next/src/next-devtools/dev-overlay/components/errors/error-overlay-toolbar/restart-server-button.tsx

Lines changed: 0 additions & 125 deletions
This file was deleted.

packages/next/src/next-devtools/dev-overlay/container/runtime-error/render-error.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import type { OverlayDispatch, OverlayState } from '../../shared'
1+
import type { OverlayState } from '../../shared'
22
import type { StackFrame } from '../../../shared/stack-frame'
33

44
import { useMemo, useState, useEffect } from 'react'
55
import {
66
getErrorByType,
77
type ReadyRuntimeError,
88
} from '../../utils/get-error-by-type'
9-
import { usePersistentCacheErrorDetection } from '../../components/errors/error-overlay-toolbar/restart-server-button'
109

1110
export type SupportedErrorEvent = {
1211
id: number
@@ -22,7 +21,6 @@ type Props = {
2221
}) => React.ReactNode
2322
state: OverlayState
2423
isAppDir: boolean
25-
dispatch: OverlayDispatch
2624
}
2725

2826
export const RenderError = (props: Props) => {
@@ -36,7 +34,7 @@ export const RenderError = (props: Props) => {
3634
}
3735
}
3836

39-
const RenderRuntimeError = ({ children, state, isAppDir, dispatch }: Props) => {
37+
const RenderRuntimeError = ({ children, state, isAppDir }: Props) => {
4038
const { errors } = state
4139

4240
const [lookups, setLookups] = useState<{
@@ -65,8 +63,6 @@ const RenderRuntimeError = ({ children, state, isAppDir, dispatch }: Props) => {
6563
return [ready, next]
6664
}, [errors, lookups])
6765

68-
usePersistentCacheErrorDetection({ errors, dispatch })
69-
7066
useEffect(() => {
7167
if (nextError == null) {
7268
return

packages/next/src/next-devtools/dev-overlay/dev-overlay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function DevOverlay() {
3333
<ComponentStyles />
3434
<DarkTheme />
3535

36-
<RenderError state={state} dispatch={dispatch} isAppDir={true}>
36+
<RenderError state={state} isAppDir={true}>
3737
{({ runtimeErrors, totalErrorCount }) => {
3838
return (
3939
<>

packages/next/src/next-devtools/dev-overlay/icons/refresh-clock-wise.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/next/src/next-devtools/dev-overlay/shared.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ export interface OverlayState {
5252
readonly staticIndicator: boolean
5353
readonly showIndicator: boolean
5454
readonly disableDevIndicator: boolean
55-
/** Whether to show the restart server button in the panel UI. Currently
56-
* only used when Turbopack + Persistent Cache is enabled.
57-
*/
58-
readonly showRestartServerButton: boolean
5955
readonly debugInfo: DebugInfo
6056
readonly routerType: 'pages' | 'app'
6157
/** This flag is used to handle the Error Overlay state in the "old" overlay.
@@ -105,7 +101,6 @@ export const ACTION_DEVTOOLS_POSITION = 'devtools-position'
105101
export const ACTION_DEVTOOLS_PANEL_POSITION = 'devtools-panel-position'
106102
export const ACTION_DEVTOOLS_PANEL_SIZE = 'devtools-panel-size'
107103
export const ACTION_DEVTOOLS_SCALE = 'devtools-scale'
108-
export const ACTION_RESTART_SERVER_BUTTON = 'restart-server-button'
109104

110105
export const ACTION_DEVTOOLS_CONFIG = 'devtools-config'
111106

@@ -216,11 +211,6 @@ export interface DevToolUpdateRouteStateAction {
216211
page: string
217212
}
218213

219-
export interface RestartServerButtonAction {
220-
type: typeof ACTION_RESTART_SERVER_BUTTON
221-
showRestartServerButton: boolean
222-
}
223-
224214
export interface DevToolsConfigAction {
225215
type: typeof ACTION_DEVTOOLS_CONFIG
226216
devToolsConfig: DevToolsConfig
@@ -248,7 +238,6 @@ export type DispatcherEvent =
248238
| DevToolsPanelPositionAction
249239
| DevToolsScaleAction
250240
| DevToolUpdateRouteStateAction
251-
| RestartServerButtonAction
252241
| DevIndicatorSetAction
253242
| DevToolsConfigAction
254243

@@ -291,7 +280,6 @@ export const INITIAL_OVERLAY_STATE: Omit<
291280
refreshState: { type: 'idle' },
292281
versionInfo: { installed: '0.0.0', staleness: 'unknown' },
293282
debugInfo: { devtoolsFrontendUrl: undefined },
294-
showRestartServerButton: false,
295283
devToolsPosition: 'bottom-left',
296284
devToolsPanelPosition: {
297285
[STORE_KEY_SHARED_PANEL_LOCATION]: 'bottom-left',
@@ -479,12 +467,6 @@ export function useErrorOverlayReducer(
479467
case ACTION_DEVTOOL_UPDATE_ROUTE_STATE: {
480468
return { ...state, page: action.page }
481469
}
482-
case ACTION_RESTART_SERVER_BUTTON: {
483-
return {
484-
...state,
485-
showRestartServerButton: action.showRestartServerButton,
486-
}
487-
}
488470
case ACTION_DEVTOOLS_CONFIG: {
489471
const {
490472
theme,

packages/next/src/next-devtools/dev-overlay/storybook/use-overlay-reducer.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
ACTION_REFRESH,
2222
ACTION_RENDERING_INDICATOR_HIDE,
2323
ACTION_RENDERING_INDICATOR_SHOW,
24-
ACTION_RESTART_SERVER_BUTTON,
2524
ACTION_STATIC_INDICATOR,
2625
ACTION_UNHANDLED_ERROR,
2726
ACTION_UNHANDLED_REJECTION,
@@ -82,7 +81,6 @@ export function useStorybookOverlayReducer(initialState?: OverlayState) {
8281
case ACTION_REFRESH:
8382
case ACTION_RENDERING_INDICATOR_HIDE:
8483
case ACTION_RENDERING_INDICATOR_SHOW:
85-
case ACTION_RESTART_SERVER_BUTTON:
8684
case ACTION_STATIC_INDICATOR:
8785
case ACTION_UNHANDLED_ERROR:
8886
case ACTION_UNHANDLED_REJECTION:

packages/next/src/next-devtools/dev-overlay/styles/component-styles.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES } from '../components/errors/dev-t
2020
import { DEV_TOOLS_INFO_ROUTE_INFO_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/route-info'
2121
import { DEV_TOOLS_INFO_USER_PREFERENCES_STYLES } from '../components/errors/dev-tools-indicator/dev-tools-info/user-preferences'
2222
import { FADER_STYLES } from '../components/fader'
23-
import { RESTART_SERVER_BUTTON_STYLES } from '../components/errors/error-overlay-toolbar/restart-server-button'
2423
import { CALL_STACK_STYLES } from '../components/call-stack/call-stack'
2524
import { ISSUE_FEEDBACK_BUTTON_STYLES } from '../components/errors/error-overlay-toolbar/issue-feedback-button'
2625
import { ERROR_CONTENT_SKELETON_STYLES } from '../container/runtime-error/error-content-skeleton'
@@ -47,7 +46,6 @@ export function ComponentStyles() {
4746
${containerErrorStyles}
4847
${containerRuntimeErrorStyles}
4948
${versionStaleness}
50-
${RESTART_SERVER_BUTTON_STYLES}
5149
${DEV_TOOLS_INFO_STYLES}
5250
${DEV_TOOLS_INFO_TURBOPACK_INFO_STYLES}
5351
${DEV_TOOLS_INFO_ROUTE_INFO_STYLES}

0 commit comments

Comments
 (0)