Unverified Commit a89d55c0 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

[dev-overlay] Remove old Dev Overlay (#76256)

This PR removed the old overlay including the deprecated `buildActivity`
and `appIsrStatus` options.

Closes NDX-785
Closes NDX-855
Closes NDX-865
Closes NDX-866
Closes NDX-867
Closes NDX-868
parent c8ac0bdd
...@@ -581,7 +581,7 @@ jobs: ...@@ -581,7 +581,7 @@ jobs:
uses: ./.github/workflows/build_reusable.yml uses: ./.github/workflows/build_reusable.yml
with: with:
nodeVersion: 18.18.2 nodeVersion: 18.18.2
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=false NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" node run-tests.js --timings -c ${TEST_CONCURRENCY} --type integration afterBuild: __NEXT_EXPERIMENTAL_PPR=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" node run-tests.js --timings -c ${TEST_CONCURRENCY} --type integration
stepName: 'test-ppr-integration' stepName: 'test-ppr-integration'
secrets: inherit secrets: inherit
...@@ -596,7 +596,7 @@ jobs: ...@@ -596,7 +596,7 @@ jobs:
group: [1/6, 2/6, 3/6, 4/6, 5/6, 6/6] group: [1/6, 2/6, 3/6, 4/6, 5/6, 6/6]
uses: ./.github/workflows/build_reusable.yml uses: ./.github/workflows/build_reusable.yml
with: with:
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=false NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type development afterBuild: __NEXT_EXPERIMENTAL_PPR=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type development
stepName: 'test-ppr-dev-${{ matrix.group }}' stepName: 'test-ppr-dev-${{ matrix.group }}'
secrets: inherit secrets: inherit
...@@ -611,7 +611,7 @@ jobs: ...@@ -611,7 +611,7 @@ jobs:
group: [1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 7/7] group: [1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 7/7]
uses: ./.github/workflows/build_reusable.yml uses: ./.github/workflows/build_reusable.yml
with: with:
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=false NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production afterBuild: __NEXT_EXPERIMENTAL_PPR=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
stepName: 'test-ppr-prod-${{ matrix.group }}' stepName: 'test-ppr-prod-${{ matrix.group }}'
secrets: inherit secrets: inherit
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
"unoptimized": false "unoptimized": false
}, },
"devIndicators": { "devIndicators": {
"buildActivity": true,
"buildActivityPosition": "bottom-right" "buildActivityPosition": "bottom-right"
}, },
"onDemandEntries": { "onDemandEntries": {
......
...@@ -213,7 +213,6 @@ pub enum BuildActivityPositions { ...@@ -213,7 +213,6 @@ pub enum BuildActivityPositions {
)] )]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct DevIndicatorsOptions { pub struct DevIndicatorsOptions {
pub build_activity: Option<bool>,
pub build_activity_position: Option<BuildActivityPositions>, pub build_activity_position: Option<BuildActivityPositions>,
pub position: Option<BuildActivityPositions>, pub position: Option<BuildActivityPositions>,
} }
......
...@@ -11,8 +11,6 @@ description: Optimized pages include an indicator to let you know if it's being ...@@ -11,8 +11,6 @@ description: Optimized pages include an indicator to let you know if it's being
```ts filename="Types" ```ts filename="Types"
devIndicators: { devIndicators: {
appIsrStatus?: boolean, // defaults to true
buildActivity?: boolean, // defaults to true
buildActivityPosition?: 'bottom-right' buildActivityPosition?: 'bottom-right'
| 'bottom-left' | 'bottom-left'
| 'top-right' | 'top-right'
...@@ -20,69 +18,6 @@ description: Optimized pages include an indicator to let you know if it's being ...@@ -20,69 +18,6 @@ description: Optimized pages include an indicator to let you know if it's being
}, },
``` ```
## `appIsrStatus` (Static Indicator)
Next.js displays a static indicator in the bottom corner of the screen that signals if a route will be prerendered at build time. This makes it easier to understand whether a route is static or dynamic, and for you to identify if a route [opts out of static rendering](#static-route-not-showing-the-indicator).
<Image
alt="App Folder Structure"
srcLight="/docs/light/static-indicator.png"
srcDark="/docs/dark/static-indicator.png"
width="1600"
height="208"
/>
You can temporarily hide the indicator by clicking the close indicator which will remember your preference in `localStorage` for 1 hour. To permanently disable it, you can use the config option in `next.config.js`:
```ts filename="next.config.ts" switcher
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
devIndicators: {
appIsrStatus: false,
},
}
export default nextConfig
```
```js filename="next.config.js" switcher
/** @type {import('next').NextConfig} */
const nextConfig = {
devIndicators: {
appIsrStatus: false,
},
}
module.exports = nextConfig
```
## `buildActivity` (Compilation Indicator)
When you edit your code, and Next.js is compiling the application, a compilation indicator appears in the bottom right corner of the page.
> **Good to know**: This indicator is only present in development mode and will not appear when building and running the app in production mode.
In some cases this indicator can be misplaced on your page, for example, when conflicting with a chat launcher. To change its position, open `next.config.js` and set the `buildActivityPosition` in the `devIndicators` object to `bottom-right` (default), `bottom-left`, `top-right` or `top-left`:
```js filename="next.config.js"
module.exports = {
devIndicators: {
buildActivityPosition: 'bottom-right',
},
}
```
In some cases, this indicator might not be useful for you. To remove it, open `next.config.js` and disable the `buildActivity` config in `devIndicators` object:
```js filename="next.config.js"
module.exports = {
devIndicators: {
buildActivity: false,
},
}
```
## Troubleshooting ## Troubleshooting
### Static route not showing the indicator ### Static route not showing the indicator
......
...@@ -2179,10 +2179,6 @@ export default async function getBaseWebpackConfig( ...@@ -2179,10 +2179,6 @@ export default async function getBaseWebpackConfig(
crossOrigin: config.crossOrigin, crossOrigin: config.crossOrigin,
pageExtensions: pageExtensions, pageExtensions: pageExtensions,
trailingSlash: config.trailingSlash, trailingSlash: config.trailingSlash,
buildActivity:
config.devIndicators === false
? false
: config.devIndicators.buildActivity,
buildActivityPosition: buildActivityPosition:
config.devIndicators === false config.devIndicators === false
? undefined ? undefined
......
...@@ -185,9 +185,6 @@ export function getDefineEnv({ ...@@ -185,9 +185,6 @@ export function getDefineEnv({
'process.env.__NEXT_APP_NAV_FAIL_HANDLING': Boolean( 'process.env.__NEXT_APP_NAV_FAIL_HANDLING': Boolean(
config.experimental.appNavFailHandling config.experimental.appNavFailHandling
), ),
'process.env.__NEXT_APP_ISR_INDICATOR': Boolean(
config.devIndicators === false ? false : config.devIndicators.appIsrStatus
),
'process.env.__NEXT_PPR': isPPREnabled, 'process.env.__NEXT_PPR': isPPREnabled,
'process.env.__NEXT_DYNAMIC_IO': isDynamicIOEnabled, 'process.env.__NEXT_DYNAMIC_IO': isDynamicIOEnabled,
'process.env.__NEXT_USE_CACHE': isUseCacheEnabled, 'process.env.__NEXT_USE_CACHE': isUseCacheEnabled,
...@@ -237,10 +234,6 @@ export function getDefineEnv({ ...@@ -237,10 +234,6 @@ export function getDefineEnv({
} }
: {}), : {}),
'process.env.__NEXT_TRAILING_SLASH': config.trailingSlash, 'process.env.__NEXT_TRAILING_SLASH': config.trailingSlash,
'process.env.__NEXT_BUILD_INDICATOR':
config.devIndicators === false
? false
: config.devIndicators.buildActivity ?? true,
'process.env.__NEXT_DEV_INDICATOR': config.devIndicators !== false, 'process.env.__NEXT_DEV_INDICATOR': config.devIndicators !== false,
'process.env.__NEXT_DEV_INDICATOR_POSITION': 'process.env.__NEXT_DEV_INDICATOR_POSITION':
config.devIndicators === false config.devIndicators === false
...@@ -296,8 +289,6 @@ export function getDefineEnv({ ...@@ -296,8 +289,6 @@ export function getDefineEnv({
needsExperimentalReact(config), needsExperimentalReact(config),
} }
: undefined), : undefined),
'process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY':
config.experimental.newDevOverlay || false,
} }
const userDefines = config.compiler?.define ?? {} const userDefines = config.compiler?.define ?? {}
......
...@@ -4,7 +4,7 @@ import type { OverlayState } from '../../../../../shared' ...@@ -4,7 +4,7 @@ import type { OverlayState } from '../../../../../shared'
import { useState, useEffect, useRef, createContext, useContext } from 'react' import { useState, useEffect, useRef, createContext, useContext } from 'react'
import { Toast } from '../../toast' import { Toast } from '../../toast'
import { NextLogo } from './internal/next-logo' import { NextLogo } from './internal/next-logo'
import { useIsDevBuilding } from '../../../../../../../dev/dev-build-indicator/internal/initialize-for-new-overlay' import { useIsDevBuilding } from '../../../../../../../dev/dev-build-indicator/internal/initialize'
import { useIsDevRendering } from './internal/dev-render-indicator' import { useIsDevRendering } from './internal/dev-render-indicator'
import { useDelayedRender } from '../../../hooks/use-delayed-render' import { useDelayedRender } from '../../../hooks/use-delayed-render'
import { noop as css } from '../../../helpers/noop-template' import { noop as css } from '../../../helpers/noop-template'
......
...@@ -341,10 +341,7 @@ function processMessage( ...@@ -341,10 +341,7 @@ function processMessage(
switch (obj.action) { switch (obj.action) {
case HMR_ACTIONS_SENT_TO_BROWSER.APP_ISR_MANIFEST: { case HMR_ACTIONS_SENT_TO_BROWSER.APP_ISR_MANIFEST: {
if ( if (process.env.__NEXT_DEV_INDICATOR) {
process.env.__NEXT_APP_ISR_INDICATOR ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY
) {
if (appIsrManifestRef) { if (appIsrManifestRef) {
appIsrManifestRef.current = obj.data appIsrManifestRef.current = obj.data
...@@ -353,24 +350,7 @@ function processMessage( ...@@ -353,24 +350,7 @@ function processMessage(
// as we'll receive the updated manifest before usePathname // as we'll receive the updated manifest before usePathname
// triggers for new value // triggers for new value
if ((pathnameRef.current as string) in obj.data) { if ((pathnameRef.current as string) in obj.data) {
if (process.env.__NEXT_APP_ISR_INDICATOR) { dispatcher.onStaticIndicator(true)
// the indicator can be hidden for an hour.
// check if it's still hidden
const indicatorHiddenAt = Number(
localStorage?.getItem('__NEXT_DISMISS_PRERENDER_INDICATOR')
)
const isHidden =
indicatorHiddenAt &&
!isNaN(indicatorHiddenAt) &&
Date.now() < indicatorHiddenAt
if (!isHidden) {
dispatcher.onStaticIndicator(true)
}
} else if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY) {
dispatcher.onStaticIndicator(true)
}
} else { } else {
dispatcher.onStaticIndicator(false) dispatcher.onStaticIndicator(false)
} }
...@@ -650,10 +630,7 @@ export default function HotReload({ ...@@ -650,10 +630,7 @@ export default function HotReload({
const appIsrManifestRef = useRef<Record<string, false | number>>({}) const appIsrManifestRef = useRef<Record<string, false | number>>({})
const pathnameRef = useRef(pathname) const pathnameRef = useRef(pathname)
if ( if (process.env.__NEXT_DEV_INDICATOR) {
process.env.__NEXT_APP_ISR_INDICATOR ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY
) {
// this conditional is only for dead-code elimination which // this conditional is only for dead-code elimination which
// isn't a runtime conditional only build-time so ignore hooks rule // isn't a runtime conditional only build-time so ignore hooks rule
// eslint-disable-next-line react-hooks/rules-of-hooks // eslint-disable-next-line react-hooks/rules-of-hooks
...@@ -665,22 +642,7 @@ export default function HotReload({ ...@@ -665,22 +642,7 @@ export default function HotReload({
if (appIsrManifest) { if (appIsrManifest) {
if (pathname && pathname in appIsrManifest) { if (pathname && pathname in appIsrManifest) {
try { try {
if (process.env.__NEXT_APP_ISR_INDICATOR) { dispatcher.onStaticIndicator(true)
const indicatorHiddenAt = Number(
localStorage?.getItem('__NEXT_DISMISS_PRERENDER_INDICATOR')
)
const isHidden =
indicatorHiddenAt &&
!isNaN(indicatorHiddenAt) &&
Date.now() < indicatorHiddenAt
if (!isHidden) {
dispatcher.onStaticIndicator(true)
}
} else if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY) {
dispatcher.onStaticIndicator(true)
}
} catch (reason) { } catch (reason) {
let message = '' let message = ''
...@@ -742,11 +704,7 @@ export default function HotReload({ ...@@ -742,11 +704,7 @@ export default function HotReload({
if (shouldRenderErrorOverlay) { if (shouldRenderErrorOverlay) {
return ( return (
<ReactDevOverlay <ReactDevOverlay state={state} globalError={globalError}>
state={state}
dispatcher={dispatcher}
globalError={globalError}
>
{children} {children}
</ReactDevOverlay> </ReactDevOverlay>
) )
......
import React from 'react'
import type { OverlayState } from '../shared'
import { ShadowPortal } from '../internal/components/ShadowPortal'
import { BuildError } from '../internal/container/BuildError'
import { Errors } from '../internal/container/Errors'
import { StaticIndicator } from '../internal/container/StaticIndicator'
import { Base } from '../internal/styles/Base'
import { ComponentStyles } from '../internal/styles/ComponentStyles'
import { CssReset } from '../internal/styles/CssReset'
import { RootLayoutMissingTagsError } from '../internal/container/RootLayoutMissingTagsError'
import type { Dispatcher } from './hot-reloader-client'
import { RuntimeErrorHandler } from '../../errors/runtime-error-handler'
import type { GlobalErrorComponent } from '../../error-boundary'
function ErroredHtml({
globalError: [GlobalError, globalErrorStyles],
error,
}: {
globalError: [GlobalErrorComponent, React.ReactNode]
error: unknown
}) {
if (!error) {
return (
<html>
<head />
<body />
</html>
)
}
return (
<>
{globalErrorStyles}
<GlobalError error={error} />
</>
)
}
interface ReactDevOverlayState {
reactError?: unknown
isReactError: boolean
}
export default class ReactDevOverlay extends React.PureComponent<
{
state: OverlayState
globalError: [GlobalErrorComponent, React.ReactNode]
dispatcher?: Dispatcher
children: React.ReactNode
},
ReactDevOverlayState
> {
state = {
reactError: null,
isReactError: false,
}
static getDerivedStateFromError(error: Error): ReactDevOverlayState {
if (!error.stack) return { isReactError: false }
RuntimeErrorHandler.hadRuntimeError = true
return {
reactError: error,
isReactError: true,
}
}
render() {
const { state, children, dispatcher, globalError } = this.props
const { isReactError, reactError } = this.state
const hasBuildError = state.buildError != null
const hasRuntimeErrors = Boolean(state.errors.length)
const hasStaticIndicator = state.staticIndicator
const debugInfo = state.debugInfo
return (
<>
{isReactError ? (
<ErroredHtml globalError={globalError} error={reactError} />
) : (
children
)}
<ShadowPortal>
<CssReset />
<Base />
<ComponentStyles />
{state.rootLayoutMissingTags?.length ? (
<RootLayoutMissingTagsError
missingTags={state.rootLayoutMissingTags}
/>
) : hasBuildError ? (
<BuildError
message={state.buildError!}
versionInfo={state.versionInfo}
/>
) : (
<>
{hasRuntimeErrors ? (
<Errors
isAppDir={true}
initialDisplayState={
isReactError ? 'fullscreen' : 'minimized'
}
errors={state.errors}
versionInfo={state.versionInfo}
hasStaticIndicator={hasStaticIndicator}
debugInfo={debugInfo}
/>
) : null}
{hasStaticIndicator && (
<StaticIndicator dispatcher={dispatcher} />
)}
</>
)}
</ShadowPortal>
</>
)
}
}
import OldReactDevOverlay from './old-react-dev-overlay'
import NewReactDevOverlay from '../_experimental/app/react-dev-overlay' import NewReactDevOverlay from '../_experimental/app/react-dev-overlay'
export default Boolean(process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY) export default NewReactDevOverlay
? NewReactDevOverlay
: OldReactDevOverlay
import * as React from 'react'
import { ShadowPortal } from '../internal/components/ShadowPortal'
import { BuildError } from '../internal/container/BuildError'
import { Errors } from '../internal/container/Errors'
import { ErrorBoundary } from './error-boundary'
import { Base } from '../internal/styles/Base'
import { ComponentStyles } from '../internal/styles/ComponentStyles'
import { CssReset } from '../internal/styles/CssReset'
import { usePagesReactDevOverlay } from './hooks'
export type ErrorType = 'runtime' | 'build'
export default function ReactDevOverlay({
children,
}: {
children?: React.ReactNode
}) {
const { hasBuildError, hasRuntimeErrors, state, onComponentError } =
usePagesReactDevOverlay()
const isMounted = hasBuildError || hasRuntimeErrors
return (
<>
<ErrorBoundary onError={onComponentError}>
{children ?? null}
</ErrorBoundary>
{isMounted ? (
<ShadowPortal>
<CssReset />
<Base />
<ComponentStyles />
{hasBuildError ? (
<BuildError
message={state.buildError!}
versionInfo={state.versionInfo}
/>
) : hasRuntimeErrors ? (
<Errors
isAppDir={false}
errors={state.errors}
versionInfo={state.versionInfo}
initialDisplayState={'fullscreen'}
/>
) : undefined}
</ShadowPortal>
) : undefined}
</>
)
}
import OldReactDevOverlay from './old-react-dev-overlay'
import NewReactDevOverlay from '../_experimental/pages/react-dev-overlay' import NewReactDevOverlay from '../_experimental/pages/react-dev-overlay'
const ReactDevOverlay = Boolean(process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY) const ReactDevOverlay = NewReactDevOverlay
? NewReactDevOverlay
: OldReactDevOverlay
export type ReactDevOverlayType = typeof ReactDevOverlay export type ReactDevOverlayType = typeof ReactDevOverlay
......
...@@ -2,9 +2,9 @@ import { devBuildIndicator } from './internal/dev-build-indicator' ...@@ -2,9 +2,9 @@ import { devBuildIndicator } from './internal/dev-build-indicator'
/** Integrates the generic dev build indicator with the App Router. */ /** Integrates the generic dev build indicator with the App Router. */
export const initializeDevBuildIndicatorForAppRouter = () => { export const initializeDevBuildIndicatorForAppRouter = () => {
if (!process.env.__NEXT_BUILD_INDICATOR) { if (!process.env.__NEXT_DEV_INDICATOR) {
return return
} }
devBuildIndicator.initialize(process.env.__NEXT_DEV_INDICATOR_POSITION) devBuildIndicator.initialize()
} }
...@@ -4,11 +4,11 @@ import { handleDevBuildIndicatorHmrEvents } from './internal/handle-dev-build-in ...@@ -4,11 +4,11 @@ import { handleDevBuildIndicatorHmrEvents } from './internal/handle-dev-build-in
/** Integrates the generic dev build indicator with the Pages Router. */ /** Integrates the generic dev build indicator with the Pages Router. */
export const initializeDevBuildIndicatorForPageRouter = () => { export const initializeDevBuildIndicatorForPageRouter = () => {
if (!process.env.__NEXT_BUILD_INDICATOR) { if (!process.env.__NEXT_DEV_INDICATOR) {
return return
} }
devBuildIndicator.initialize(process.env.__NEXT_DEV_INDICATOR_POSITION) devBuildIndicator.initialize()
// Add message listener specifically for Pages Router to handle lifecycle events // Add message listener specifically for Pages Router to handle lifecycle events
// related to dev builds (building, built, sync) // related to dev builds (building, built, sync)
......
import { initialize } from './initialize'
const NOOP = () => {} const NOOP = () => {}
export const devBuildIndicator = { export const devBuildIndicator = {
...@@ -6,11 +8,5 @@ export const devBuildIndicator = { ...@@ -6,11 +8,5 @@ export const devBuildIndicator = {
/** Hides build indicator when Next.js finishes compiling. Requires initialize() first. */ /** Hides build indicator when Next.js finishes compiling. Requires initialize() first. */
hide: NOOP, hide: NOOP,
/** Sets up the build indicator UI component. Call this before using show/hide. */ /** Sets up the build indicator UI component. Call this before using show/hide. */
initialize: process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY initialize,
? (
require('./initialize-for-new-overlay') as typeof import('./initialize-for-new-overlay')
).initializeForNewOverlay
: (
require('./initialize-for-old-overlay') as typeof import('./initialize-for-old-overlay')
).initializeForOldOverlay,
} }
/*
* Initializes the build indicator for the old overlay
* This is a singleton store to track whether the app is currently being built
* Used by the dev tools indicator of the old overlay to show build status
*/
import { devBuildIndicator } from './dev-build-indicator'
type VerticalPosition = 'top' | 'bottom'
type HorizonalPosition = 'left' | 'right'
export function initializeForOldOverlay(position = 'bottom-right') {
const shadowHost = document.createElement('div')
const [verticalProperty, horizontalProperty] = position.split('-', 2) as [
VerticalPosition,
HorizonalPosition,
]
shadowHost.id = '__next-build-indicator'
// Make sure container is fixed and on a high zIndex so it shows
shadowHost.style.position = 'fixed'
// Ensure container's position to be top or bottom (default)
shadowHost.style[verticalProperty] = '10px'
// Ensure container's position to be left or right (default)
shadowHost.style[horizontalProperty] = '20px'
shadowHost.style.width = '0'
shadowHost.style.height = '0'
shadowHost.style.zIndex = '99999'
document.body.appendChild(shadowHost)
let shadowRoot
let prefix = ''
if (shadowHost.attachShadow) {
shadowRoot = shadowHost.attachShadow({ mode: 'open' })
} else {
// If attachShadow is undefined then the browser does not support
// the Shadow DOM, we need to prefix all the names so there
// will be no conflicts
shadowRoot = shadowHost
prefix = '__next-build-indicator-'
}
// Container
const container = createContainer(prefix)
shadowRoot.appendChild(container)
// CSS
const css = createCss(prefix, { horizontalProperty, verticalProperty })
shadowRoot.appendChild(css)
// State
let isVisible = false
let isBuilding = false
let timeoutId: null | ReturnType<typeof setTimeout> = null
devBuildIndicator.show = () => {
timeoutId && clearTimeout(timeoutId)
isVisible = true
isBuilding = true
updateContainer()
}
devBuildIndicator.hide = () => {
isBuilding = false
// Wait for the fade out transition to complete
timeoutId = setTimeout(() => {
isVisible = false
updateContainer()
}, 100)
updateContainer()
}
function updateContainer() {
if (isBuilding) {
container.classList.add(`${prefix}building`)
} else {
container.classList.remove(`${prefix}building`)
}
if (isVisible) {
container.classList.add(`${prefix}visible`)
} else {
container.classList.remove(`${prefix}visible`)
}
}
}
function createContainer(prefix: string) {
const container = document.createElement('div')
container.id = `${prefix}container`
container.innerHTML = `
<div id="${prefix}icon-wrapper">
<svg viewBox="0 0 226 200">
<defs>
<linearGradient
x1="114.720775%"
y1="181.283245%"
x2="39.5399306%"
y2="100%"
id="${prefix}linear-gradient"
>
<stop stop-color="#000000" offset="0%" />
<stop stop-color="#FFFFFF" offset="100%" />
</linearGradient>
</defs>
<g id="${prefix}icon-group" fill="none" stroke="url(#${prefix}linear-gradient)" stroke-width="18">
<path d="M113,5.08219117 L4.28393801,197.5 L221.716062,197.5 L113,5.08219117 Z" />
</g>
</svg>
</div>
`
return container
}
function createCss(
prefix: string,
{
horizontalProperty,
verticalProperty,
}: { horizontalProperty: string; verticalProperty: string }
) {
const css = document.createElement('style')
css.textContent = `
#${prefix}container {
position: absolute;
${verticalProperty}: 10px;
${horizontalProperty}: 30px;
border-radius: 3px;
background: #000;
color: #fff;
font: initial;
cursor: initial;
letter-spacing: initial;
text-shadow: initial;
text-transform: initial;
visibility: initial;
padding: 7px 10px 8px 10px;
align-items: center;
box-shadow: 0 11px 40px 0 rgba(0, 0, 0, 0.25), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
display: none;
opacity: 0;
transition: opacity 0.1s ease, ${verticalProperty} 0.1s ease;
animation: ${prefix}fade-in 0.1s ease-in-out;
}
#${prefix}container.${prefix}visible {
display: flex;
}
#${prefix}container.${prefix}building {
${verticalProperty}: 20px;
opacity: 1;
}
#${prefix}icon-wrapper {
width: 16px;
height: 16px;
}
#${prefix}icon-wrapper > svg {
width: 100%;
height: 100%;
}
#${prefix}icon-group {
animation: ${prefix}strokedash 1s ease-in-out both infinite;
}
@keyframes ${prefix}fade-in {
from {
${verticalProperty}: 10px;
opacity: 0;
}
to {
${verticalProperty}: 20px;
opacity: 1;
}
}
@keyframes ${prefix}strokedash {
0% {
stroke-dasharray: 0 226;
}
80%,
100% {
stroke-dasharray: 659 226;
}
}
`
return css
}
...@@ -22,7 +22,7 @@ export function useIsDevBuilding() { ...@@ -22,7 +22,7 @@ export function useIsDevBuilding() {
return useSyncExternalStore(subscribe, getSnapshot) return useSyncExternalStore(subscribe, getSnapshot)
} }
export function initializeForNewOverlay() { export function initialize() {
devBuildIndicator.show = () => { devBuildIndicator.show = () => {
isVisible = true isVisible = true
listeners.forEach((listener) => listener()) listeners.forEach((listener) => listener())
......
...@@ -230,8 +230,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() => ...@@ -230,8 +230,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
devIndicators: z devIndicators: z
.union([ .union([
z.object({ z.object({
appIsrStatus: z.boolean().optional(),
buildActivity: z.boolean().optional(),
buildActivityPosition: z buildActivityPosition: z
.union([ .union([
z.literal('bottom-left'), z.literal('bottom-left'),
...@@ -266,7 +264,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() => ...@@ -266,7 +264,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
nodeMiddleware: z.boolean().optional(), nodeMiddleware: z.boolean().optional(),
after: z.boolean().optional(), after: z.boolean().optional(),
appDocumentPreloading: z.boolean().optional(), appDocumentPreloading: z.boolean().optional(),
appIsrStatus: z.boolean().optional(),
appNavFailHandling: z.boolean().optional(), appNavFailHandling: z.boolean().optional(),
preloadEntriesOnStart: z.boolean().optional(), preloadEntriesOnStart: z.boolean().optional(),
allowedRevalidateHeaderKeys: z.array(z.string()).optional(), allowedRevalidateHeaderKeys: z.array(z.string()).optional(),
......
...@@ -469,14 +469,14 @@ function assignDefaults( ...@@ -469,14 +469,14 @@ function assignDefaults(
warnOptionHasBeenDeprecated( warnOptionHasBeenDeprecated(
result, result,
'devIndicators.appIsrStatus', 'devIndicators.appIsrStatus',
`\`devIndicators.appIsrStatus\` is no longer needed and is enabled by default. You can remove it from ${configFileName}.`, `\`devIndicators.appIsrStatus\` is deprecated and no longer configurable. Please remove it from ${configFileName}.`,
silent silent
) )
warnOptionHasBeenDeprecated( warnOptionHasBeenDeprecated(
result, result,
'devIndicators.buildActivity', 'devIndicators.buildActivity',
`\`devIndicators.buildActivity\` is no longer needed and is enabled by default. You can remove it from ${configFileName}.`, `\`devIndicators.buildActivity\` is deprecated and no longer configurable. Please remove it from ${configFileName}.`,
silent silent
) )
...@@ -955,24 +955,8 @@ function assignDefaults( ...@@ -955,24 +955,8 @@ function assignDefaults(
result.experimental = {} result.experimental = {}
} }
// TODO(jiwon): remove once we've made new UI default
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'false') {
result.experimental.newDevOverlay = false
}
// Preserve the default indicator options for old overlay. // Preserve the default indicator options for old overlay.
if (result.experimental.newDevOverlay !== true) { if (result.experimental.newDevOverlay !== true) {
result.devIndicators = {
...result.devIndicators,
appIsrStatus:
result.devIndicators === false
? false
: result.devIndicators?.appIsrStatus ?? true,
buildActivity:
result.devIndicators === false
? false
: result.devIndicators?.buildActivity ?? true,
}
// If the user didn't explicitly set `position` or `buildActivityPosition` option, // If the user didn't explicitly set `position` or `buildActivityPosition` option,
// the default is going to be "bottom-left". However, the default position for the // the default is going to be "bottom-left". However, the default position for the
// old build activity indicator was "bottom-right" which becomes a breaking change. // old build activity indicator was "bottom-right" which becomes a breaking change.
...@@ -980,9 +964,10 @@ function assignDefaults( ...@@ -980,9 +964,10 @@ function assignDefaults(
if (!hasWarnedBuildActivityPosition) { if (!hasWarnedBuildActivityPosition) {
result.devIndicators = { result.devIndicators = {
...result.devIndicators, ...result.devIndicators,
position: userConfig.devIndicators?.position position:
? result.devIndicators.position userConfig.devIndicators?.position && result.devIndicators !== false
: 'bottom-right', ? result.devIndicators?.position
: 'bottom-right',
} }
} }
} }
......
...@@ -50,12 +50,6 @@ const ENDGROUP = process.env.CI ? '##[endgroup]' : '' ...@@ -50,12 +50,6 @@ const ENDGROUP = process.env.CI ? '##[endgroup]' : ''
const externalTestsFilter = getTestFilter() const externalTestsFilter = getTestFilter()
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (!process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY) {
console.log('Setting __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY to true')
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY = 'true'
}
const timings = [] const timings = []
const DEFAULT_NUM_RETRIES = 2 const DEFAULT_NUM_RETRIES = 2
const DEFAULT_CONCURRENCY = 2 const DEFAULT_CONCURRENCY = 2
......
...@@ -32,14 +32,8 @@ describe('dynamic = "error" in devmode', () => { ...@@ -32,14 +32,8 @@ describe('dynamic = "error" in devmode', () => {
const { session } = sandbox const { session } = sandbox
await session.assertHasRedbox() await session.assertHasRedbox()
const description = await session.getRedboxDescription() const description = await session.getRedboxDescription()
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') { expect(description).toMatchInlineSnapshot(
expect(description).toMatchInlineSnapshot( `"Error: Route /server with \`dynamic = "error"\` couldn't be rendered statically because it used \`cookies\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering"`
`"Error: Route /server with \`dynamic = "error"\` couldn't be rendered statically because it used \`cookies\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering"` )
)
} else {
expect(description).toMatchInlineSnapshot(
`"[ Server ] Error: Route /server with \`dynamic = "error"\` couldn't be rendered statically because it used \`cookies\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering"`
)
}
}) })
}) })
...@@ -65,24 +65,19 @@ describe('Error overlay - editor links', () => { ...@@ -65,24 +65,19 @@ describe('Error overlay - editor links', () => {
` `
) )
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
// Ensure the Next Logo is not loading. This is to assert that the build did stop. // Ensure the Next Logo is not loading. This is to assert that the build did stop.
if (isNewDevOverlay) { await retry(async () => {
await retry(async () => { const loaded = await browser.eval(() => {
const loaded = await browser.eval(() => { return Boolean(
return Boolean( [].slice
[].slice .call(document.querySelectorAll('nextjs-portal'))
.call(document.querySelectorAll('nextjs-portal')) .find((p) =>
.find((p) => p.shadowRoot.querySelector('[data-next-mark-loading="false"]')
p.shadowRoot.querySelector('[data-next-mark-loading="false"]') )
) )
)
})
expect(loaded).toBe(true)
}) })
} expect(loaded).toBe(true)
})
await session.assertHasRedbox() await session.assertHasRedbox()
await clickSourceFile(browser) await clickSourceFile(browser)
......
...@@ -215,7 +215,7 @@ describe('Error overlay for hydration errors in App router', () => { ...@@ -215,7 +215,7 @@ describe('Error overlay for hydration errors in App router', () => {
expect(pseudoHtml).toMatchInlineSnapshot(` expect(pseudoHtml).toMatchInlineSnapshot(`
"... "...
<HotReload assetPrefix="" globalError={[...]}> <HotReload assetPrefix="" globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}> <ReactDevOverlay state={{nextId:1, ...}} globalError={[...]}>
<DevOverlayErrorBoundary devOverlay={<Fragment>} globalError={[...]} onError={function bound dispatchSetState}> <DevOverlayErrorBoundary devOverlay={<Fragment>} globalError={[...]} onError={function bound dispatchSetState}>
<DevRootHTTPAccessFallbackBoundary> <DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}> <HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
...@@ -238,7 +238,7 @@ describe('Error overlay for hydration errors in App router', () => { ...@@ -238,7 +238,7 @@ describe('Error overlay for hydration errors in App router', () => {
expect(pseudoHtml).toMatchInlineSnapshot(` expect(pseudoHtml).toMatchInlineSnapshot(`
"... "...
<HotReload assetPrefix="" globalError={[...]}> <HotReload assetPrefix="" globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}> <ReactDevOverlay state={{nextId:1, ...}} globalError={[...]}>
<DevOverlayErrorBoundary devOverlay={<Fragment>} globalError={[...]} onError={function bound dispatchSetState}> <DevOverlayErrorBoundary devOverlay={<Fragment>} globalError={[...]} onError={function bound dispatchSetState}>
<DevRootHTTPAccessFallbackBoundary> <DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}> <HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
......
...@@ -8,9 +8,6 @@ import { ...@@ -8,9 +8,6 @@ import {
getVersionCheckerText, getVersionCheckerText,
} from 'next-test-utils' } from 'next-test-utils'
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('Error overlay - RSC runtime errors', () => { describe('Error overlay - RSC runtime errors', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'rsc-runtime-errors')), files: new FileRef(path.join(__dirname, 'fixtures', 'rsc-runtime-errors')),
...@@ -111,11 +108,7 @@ describe('Error overlay - RSC runtime errors', () => { ...@@ -111,11 +108,7 @@ describe('Error overlay - RSC runtime errors', () => {
await assertHasRedbox(browser) await assertHasRedbox(browser)
const versionText = await getVersionCheckerText(browser) const versionText = await getVersionCheckerText(browser)
if (isNewDevOverlay) { expect(versionText).toMatch(/Next.js [\w.-]+/)
expect(versionText).toMatch(/Next.js [\w.-]+/)
} else {
expect(versionText).toMatch(/Next.js \([\w.-]+\)/)
}
}) })
it('should not show the bundle layer info in the file trace', async () => { it('should not show the bundle layer info in the file trace', async () => {
......
...@@ -11,9 +11,6 @@ function getStaleness(browser: BrowserInterface) { ...@@ -11,9 +11,6 @@ function getStaleness(browser: BrowserInterface) {
.text() .text()
} }
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('Error Overlay version staleness', () => { describe('Error Overlay version staleness', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')), files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
...@@ -50,28 +47,15 @@ describe('Error Overlay version staleness', () => { ...@@ -50,28 +47,15 @@ describe('Error Overlay version staleness', () => {
await session.openRedbox() await session.openRedbox()
if (isNewDevOverlay) { if (process.env.TURBOPACK) {
if (process.env.TURBOPACK) { expect(await getStaleness(browser)).toMatchInlineSnapshot(`
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
"Next.js 1.0.0 (outdated) "Next.js 1.0.0 (outdated)
Turbopack" Turbopack"
`) `)
} else {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js 1.0.0 (outdated)"`
)
}
} else { } else {
if (process.env.TURBOPACK) { expect(await getStaleness(browser)).toMatchInlineSnapshot(
expect(await getStaleness(browser)).toMatchInlineSnapshot(` `"Next.js 1.0.0 (outdated)"`
"Next.js 1.0.0 (outdated) )
Turbopack"
`)
} else {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js 1.0.0 (outdated)"`
)
}
} }
}) })
......
...@@ -5,9 +5,6 @@ import { outdent } from 'outdent' ...@@ -5,9 +5,6 @@ import { outdent } from 'outdent'
import { getRedboxTotalErrorCount, retry } from 'next-test-utils' import { getRedboxTotalErrorCount, retry } from 'next-test-utils'
const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18 const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
// https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference // https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference
describe('Error overlay for hydration errors in Pages router', () => { describe('Error overlay for hydration errors in Pages router', () => {
...@@ -489,11 +486,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -489,11 +486,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
) )
const { session, browser } = sandbox const { session, browser } = sandbox
// in the new overlay, `assertHasRedbox` is redundant with `hasErrorToast`
if (!isNewDevOverlay) {
await expect(session.hasErrorToast()).resolves.toBe(false)
}
await session.assertHasRedbox() await session.assertHasRedbox()
if (isReact18) { if (isReact18) {
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { assertNoRedbox, assertNoConsoleErrors } from 'next-test-utils' import { assertNoRedbox, assertNoConsoleErrors } from 'next-test-utils'
const isNewOverlay = process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY !== 'false'
describe('app-dir - capture-console-error-owner-stack', () => { describe('app-dir - capture-console-error-owner-stack', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
...@@ -109,8 +107,7 @@ describe('app-dir - capture-console-error-owner-stack', () => { ...@@ -109,8 +107,7 @@ describe('app-dir - capture-console-error-owner-stack', () => {
it('should be able to capture rsc logged error', async () => { it('should be able to capture rsc logged error', async () => {
const browser = await next.browser('/rsc') const browser = await next.browser('/rsc')
if (isNewOverlay) { await expect(browser).toDisplayCollapsedRedbox(`
await expect(browser).toDisplayCollapsedRedbox(`
{ {
"count": 1, "count": 1,
"description": "Error: boom", "description": "Error: boom",
...@@ -126,24 +123,6 @@ describe('app-dir - capture-console-error-owner-stack', () => { ...@@ -126,24 +123,6 @@ describe('app-dir - capture-console-error-owner-stack', () => {
], ],
} }
`) `)
} else {
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "[ Server ] Error: boom",
"environmentLabel": null,
"label": "Console Error",
"source": "app/rsc/page.js (2:17) @ Page
> 2 | console.error(new Error('boom'))
| ^",
"stack": [
"Page app/rsc/page.js (2:17)",
"JSON.parse <anonymous> (0:0)",
"Page <anonymous> (0:0)",
],
}
`)
}
}) })
it('should display the error message in error event when event.error is not present', async () => { it('should display the error message in error event when event.error is not present', async () => {
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { getRouteTypeFromDevToolsIndicator, retry } from 'next-test-utils' import { getRouteTypeFromDevToolsIndicator, retry } from 'next-test-utils'
import { BrowserInterface } from 'next-webdriver'
describe('prerender indicator', () => { describe('dev indicator - route type', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
const isNewDevOverlay = it('should have route type as static by default for static page', async () => {
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
async function hasStaticIndicator(browser: BrowserInterface) {
if (isNewDevOverlay) {
const routeType = await getRouteTypeFromDevToolsIndicator(browser)
console.log({ routeType })
return routeType === 'Static'
}
const staticIndicatorPresent = await browser.eval(() =>
Boolean(
document
.querySelector('nextjs-portal')
.shadowRoot.querySelector('.nextjs-static-indicator-toast-wrapper')
)
)
return staticIndicatorPresent
}
it('should have prerender-indicator by default for static page', async () => {
const browser = await next.browser('/') const browser = await next.browser('/')
await retry(async () => { await retry(async () => {
expect(await hasStaticIndicator(browser)).toBe(true) expect(await getRouteTypeFromDevToolsIndicator(browser)).toBe('Static')
}) })
}) })
it('should hide the indicator when changing to dynamic', async () => { it('should have route type as dynamic when changing to dynamic page', async () => {
const browser = await next.browser('/') const browser = await next.browser('/')
const origContent = await next.readFile('app/page.tsx') const origContent = await next.readFile('app/page.tsx')
...@@ -46,14 +25,14 @@ describe('prerender indicator', () => { ...@@ -46,14 +25,14 @@ describe('prerender indicator', () => {
try { try {
await retry(async () => { await retry(async () => {
expect(await hasStaticIndicator(browser)).toBe(false) expect(await getRouteTypeFromDevToolsIndicator(browser)).toBe('Dynamic')
}) })
} finally { } finally {
await next.patchFile('app/page.tsx', origContent) await next.patchFile('app/page.tsx', origContent)
} }
}) })
it('should not have the indicator on dynamic page on load', async () => { it('should have route type as dynamic when on load of dynamic page', async () => {
const origContent = await next.readFile('app/page.tsx') const origContent = await next.readFile('app/page.tsx')
await next.patchFile( await next.patchFile(
...@@ -65,44 +44,18 @@ describe('prerender indicator', () => { ...@@ -65,44 +44,18 @@ describe('prerender indicator', () => {
try { try {
await retry(async () => { await retry(async () => {
expect(await hasStaticIndicator(browser)).toBe(false) expect(await getRouteTypeFromDevToolsIndicator(browser)).toBe('Dynamic')
}) })
} finally { } finally {
await next.patchFile('app/page.tsx', origContent) await next.patchFile('app/page.tsx', origContent)
} }
}) })
// TODO(jiwon): The new UI will always show the route type. it('should have route type as dynamic when using force-dynamic', async () => {
if (!isNewDevOverlay) {
it.skip('should not show the indicator if disabled in next.config', async () => {
await next.stop()
await next.patchFile(
'next.config.js',
`
module.exports = {
devIndicators: {
appIsrStatus: false
}
}
`
)
try {
await next.start()
const browser = await next.browser('/')
expect(await hasStaticIndicator(browser)).toBe(false)
} finally {
await next.deleteFile('app/page.tsx')
}
})
}
it('should not have static indicator when using force-dynamic', async () => {
const browser = await next.browser('/force-dynamic') const browser = await next.browser('/force-dynamic')
await browser.waitForElementByCss('#ready') await browser.waitForElementByCss('#ready')
expect(await hasStaticIndicator(browser)).toBe(false) expect(await getRouteTypeFromDevToolsIndicator(browser)).toBe('Dynamic')
}) })
}) })
...@@ -9,14 +9,10 @@ describe('Dynamic IO Dev Errors', () => { ...@@ -9,14 +9,10 @@ describe('Dynamic IO Dev Errors', () => {
files: __dirname, files: __dirname,
}) })
const isNewOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY !== 'false'
it('should show a red box error on the SSR render', async () => { it('should show a red box error on the SSR render', async () => {
const browser = await next.browser('/error') const browser = await next.browser('/error')
if (isNewOverlay) { await expect(browser).toDisplayCollapsedRedbox(`
await expect(browser).toDisplayCollapsedRedbox(`
{ {
"count": 1, "count": 1,
"description": "Error: Route "/error" used \`Math.random()\` outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random", "description": "Error: Route "/error" used \`Math.random()\` outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random",
...@@ -32,24 +28,6 @@ describe('Dynamic IO Dev Errors', () => { ...@@ -32,24 +28,6 @@ describe('Dynamic IO Dev Errors', () => {
], ],
} }
`) `)
} else {
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "[ Server ] Error: Route "/error" used \`Math.random()\` outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random",
"environmentLabel": null,
"label": "Console Error",
"source": "app/error/page.tsx (2:23) @ Page
> 2 | const random = Math.random()
| ^",
"stack": [
"Page app/error/page.tsx (2:23)",
"JSON.parse <anonymous> (0:0)",
"<unknown> <anonymous> (0:0)",
],
}
`)
}
}) })
it('should show a red box error on client navigations', async () => { it('should show a red box error on client navigations', async () => {
...@@ -61,8 +39,7 @@ describe('Dynamic IO Dev Errors', () => { ...@@ -61,8 +39,7 @@ describe('Dynamic IO Dev Errors', () => {
await browser.elementByCss("[href='/error']").click() await browser.elementByCss("[href='/error']").click()
if (isNewOverlay) { await expect(browser).toDisplayCollapsedRedbox(`
await expect(browser).toDisplayCollapsedRedbox(`
{ {
"count": 1, "count": 1,
"description": "Error: Route "/error" used \`Math.random()\` outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random", "description": "Error: Route "/error" used \`Math.random()\` outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random",
...@@ -78,24 +55,6 @@ describe('Dynamic IO Dev Errors', () => { ...@@ -78,24 +55,6 @@ describe('Dynamic IO Dev Errors', () => {
], ],
} }
`) `)
} else {
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "[ Server ] Error: Route "/error" used \`Math.random()\` outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random",
"environmentLabel": null,
"label": "Console Error",
"source": "app/error/page.tsx (2:23) @ Page
> 2 | const random = Math.random()
| ^",
"stack": [
"Page app/error/page.tsx (2:23)",
"JSON.parse <anonymous> (0:0)",
"<unknown> <anonymous> (0:0)",
],
}
`)
}
}) })
it('should not log unhandled rejections for persistently thrown top-level errors', async () => { it('should not log unhandled rejections for persistently thrown top-level errors', async () => {
...@@ -141,8 +100,7 @@ describe('Dynamic IO Dev Errors', () => { ...@@ -141,8 +100,7 @@ describe('Dynamic IO Dev Errors', () => {
'\n at InnerLayoutRouter (..') '\n at InnerLayoutRouter (..')
) )
if (isNewOverlay) { await expect(browser).toDisplayCollapsedRedbox(`
await expect(browser).toDisplayCollapsedRedbox(`
{ {
"count": 1, "count": 1,
"description": "Error: Route "/no-accessed-data": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don't have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense", "description": "Error: Route "/no-accessed-data": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don't have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense",
...@@ -160,26 +118,6 @@ describe('Dynamic IO Dev Errors', () => { ...@@ -160,26 +118,6 @@ describe('Dynamic IO Dev Errors', () => {
], ],
} }
`) `)
} else {
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "[ Server ] Error: Route "/no-accessed-data": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don't have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense",
"environmentLabel": null,
"label": "Console Error",
"source": undefined,
"stack": [
"Page [Server] <anonymous> (2:1)",
"main <anonymous> (2:1)",
"body <anonymous> (2:1)",
"html <anonymous> (2:1)",
"Root [Server] <anonymous> (2:1)",
"JSON.parse <anonymous> (0:0)",
"<unknown> <anonymous> (0:0)",
],
}
`)
}
}) })
it('should clear segment errors after correcting them', async () => { it('should clear segment errors after correcting them', async () => {
...@@ -201,8 +139,7 @@ describe('Dynamic IO Dev Errors', () => { ...@@ -201,8 +139,7 @@ describe('Dynamic IO Dev Errors', () => {
) )
const { browser, session } = sandbox const { browser, session } = sandbox
if (isTurbopack) { if (isTurbopack) {
if (isNewOverlay) { await expect(browser).toDisplayRedbox(`
await expect(browser).toDisplayRedbox(`
{ {
"count": 1, "count": 1,
"description": "Failed to compile", "description": "Failed to compile",
...@@ -215,21 +152,6 @@ describe('Dynamic IO Dev Errors', () => { ...@@ -215,21 +152,6 @@ describe('Dynamic IO Dev Errors', () => {
"stack": [], "stack": [],
} }
`) `)
} else {
await expect(browser).toDisplayRedbox(`
{
"count": 1,
"description": "Failed to compile",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/page.tsx:1:14
Ecmascript file had an error
> 1 | export const revalidate = 10
| ^^^^^^^^^^",
"stack": [],
}
`)
}
} else { } else {
await expect(browser).toDisplayRedbox(` await expect(browser).toDisplayRedbox(`
{ {
......
...@@ -11,8 +11,6 @@ describe('error-ignored-frames', () => { ...@@ -11,8 +11,6 @@ describe('error-ignored-frames', () => {
}) })
if ( if (
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' ||
// Skip react 18 test as the call stacks are different // Skip react 18 test as the call stacks are different
process.env.NEXT_TEST_REACT_VERSION === '18.3.1' process.env.NEXT_TEST_REACT_VERSION === '18.3.1'
) { ) {
...@@ -108,8 +106,8 @@ describe('error-ignored-frames', () => { ...@@ -108,8 +106,8 @@ describe('error-ignored-frames', () => {
} else { } else {
expect(expendedStack).toMatchInlineSnapshot(` expect(expendedStack).toMatchInlineSnapshot(`
"at eval (app/interleaved/page.tsx (7:11)) "at eval (app/interleaved/page.tsx (7:11))
at invokeCallback (node_modules/interleave/index.js (2:1))
at Page (app/interleaved/page.tsx (6:36)) at Page (app/interleaved/page.tsx (6:36))
at invokeCallback (node_modules/interleave/index.js (2:1))
at ClientPageRoot (../src/client/components/client-page.tsx (60:12))" at ClientPageRoot (../src/client/components/client-page.tsx (60:12))"
`) `)
} }
......
export default function Layout({ children }) {
return <body>{children}</body>
}
export default function Page() {
return <p>hello world</p>
}
import { nextTestSetup } from 'e2e-utils'
import {
assertHasRedbox,
assertNoRedbox,
getRedboxDescription,
getToastErrorCount,
hasErrorToast,
retry,
} from 'next-test-utils'
import { outdent } from 'outdent'
// TODO(new-dev-overlay): merge with test/development/app-dir/missing-required-html-tags/index.test.ts
// once new overlay is stable
const isDisabled = process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'false'
;(isDisabled ? describe.skip : describe)(
'app-dir - missing required html tags',
() => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should display correct error count in dev indicator', async () => {
const browser = await next.browser('/')
retry(async () => {
expect(await hasErrorToast(browser)).toBe(true)
})
// Dev indicator should show 1 error
expect(await getToastErrorCount(browser)).toBe(1)
await assertHasRedbox(browser)
await retry(async () => {
expect(await getRedboxDescription(browser)).toEqual(outdent`
The following tags are missing in the Root Layout: <html>.
Read more at https://nextjs.org/docs/messages/missing-root-layout-tags
`)
})
await next.patchFile('app/layout.js', (code) =>
code.replace(
'return <body>{children}</body>',
'return <html><body>{children}</body></html>'
)
)
await assertNoRedbox(browser)
expect(await browser.elementByCss('p').text()).toBe('hello world')
})
}
)
/**
* @type {import('next').NextConfig}
*/
module.exports = {
experimental: {
newDevOverlay: true,
},
}
...@@ -3,6 +3,8 @@ import { ...@@ -3,6 +3,8 @@ import {
assertHasRedbox, assertHasRedbox,
assertNoRedbox, assertNoRedbox,
getRedboxDescription, getRedboxDescription,
getToastErrorCount,
hasErrorToast,
retry, retry,
} from 'next-test-utils' } from 'next-test-utils'
import { outdent } from 'outdent' import { outdent } from 'outdent'
...@@ -10,6 +12,16 @@ import { outdent } from 'outdent' ...@@ -10,6 +12,16 @@ import { outdent } from 'outdent'
describe('app-dir - missing required html tags', () => { describe('app-dir - missing required html tags', () => {
const { next } = nextTestSetup({ files: __dirname }) const { next } = nextTestSetup({ files: __dirname })
it('should display correct error count in dev indicator', async () => {
const browser = await next.browser('/')
retry(async () => {
expect(await hasErrorToast(browser)).toBe(true)
})
// Dev indicator should show 1 error
expect(await getToastErrorCount(browser)).toBe(1)
})
it('should show error overlay', async () => { it('should show error overlay', async () => {
const browser = await next.browser('/') const browser = await next.browser('/')
......
...@@ -51,9 +51,6 @@ describe('app-dir - owner-stack', () => { ...@@ -51,9 +51,6 @@ describe('app-dir - owner-stack', () => {
files: __dirname, files: __dirname,
}) })
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
it('should log stitched error for browser uncaught errors', async () => { it('should log stitched error for browser uncaught errors', async () => {
const browser = await next.browser('/browser/uncaught') const browser = await next.browser('/browser/uncaught')
...@@ -71,10 +68,8 @@ describe('app-dir - owner-stack', () => { ...@@ -71,10 +68,8 @@ describe('app-dir - owner-stack', () => {
return log.message.includes('Error: browser error') return log.message.includes('Error: browser error')
}).message }).message
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed if (process.env.TURBOPACK) {
if (isNewDevOverlay) { expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
if (process.env.TURBOPACK) {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o "%o
%s Error: browser error %s Error: browser error
at useThrowError at useThrowError
...@@ -92,48 +87,8 @@ describe('app-dir - owner-stack', () => { ...@@ -92,48 +87,8 @@ describe('app-dir - owner-stack', () => {
at performWorkOnRootViaSchedulerTask at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary." at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary."
`) `)
} else {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o
%s Error: browser error
at useThrowError
at useErrorHook
at Page
at react-stack-bottom-frame
at renderWithHooks
at updateFunctionComponent
at beginWork
at runWithFiberInDEV
at performUnitOfWork
at workLoopSync
at renderRootSync
at performWorkOnRoot
at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary."
`)
}
} else { } else {
if (process.env.TURBOPACK) { expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o
%s Error: browser error
at useThrowError
at useErrorHook
at Page
at react-stack-bottom-frame
at renderWithHooks
at updateFunctionComponent
at beginWork
at runWithFiberInDEV
at performUnitOfWork
at workLoopSync
at renderRootSync
at performWorkOnRoot
at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <ReactDevOverlay> error boundary."
`)
} else {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o "%o
%s Error: browser error %s Error: browser error
at useThrowError at useThrowError
...@@ -149,9 +104,8 @@ describe('app-dir - owner-stack', () => { ...@@ -149,9 +104,8 @@ describe('app-dir - owner-stack', () => {
at renderRootSync at renderRootSync
at performWorkOnRoot at performWorkOnRoot
at performWorkOnRootViaSchedulerTask at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <ReactDevOverlay> error boundary." at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary."
`) `)
}
} }
}) })
...@@ -214,8 +168,7 @@ describe('app-dir - owner-stack', () => { ...@@ -214,8 +168,7 @@ describe('app-dir - owner-stack', () => {
return log.message.includes('Error: ssr error') return log.message.includes('Error: ssr error')
}).message }).message
if (isNewDevOverlay) { expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o "%o
%s Error: ssr error %s Error: ssr error
at useThrowError at useThrowError
...@@ -233,26 +186,6 @@ describe('app-dir - owner-stack', () => { ...@@ -233,26 +186,6 @@ describe('app-dir - owner-stack', () => {
at performWorkOnRootViaSchedulerTask at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary." at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary."
`) `)
} else {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o
%s Error: ssr error
at useThrowError
at useErrorHook
at Page
at react-stack-bottom-frame
at renderWithHooks
at updateFunctionComponent
at beginWork
at runWithFiberInDEV
at performUnitOfWork
at workLoopSync
at renderRootSync
at performWorkOnRoot
at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <ReactDevOverlay> error boundary."
`)
}
}) })
it('should capture unhandled promise rejections', async () => { it('should capture unhandled promise rejections', async () => {
......
...@@ -15,16 +15,9 @@ describe('serialize-circular-error', () => { ...@@ -15,16 +15,9 @@ describe('serialize-circular-error', () => {
await assertHasRedbox(browser) await assertHasRedbox(browser)
const description = await getRedboxDescription(browser) const description = await getRedboxDescription(browser)
// React cannot serialize thrown objects with circular references expect(description).toBe(
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') { `Error: An error occurred but serializing the error message failed.`
expect(description).toBe( )
`Error: An error occurred but serializing the error message failed.`
)
} else {
expect(description).toBe(
`[ Server ] Error: An error occurred but serializing the error message failed.`
)
}
const output = next.cliOutput const output = next.cliOutput
expect(output).toContain( expect(output).toContain(
......
...@@ -5,10 +5,6 @@ import { ...@@ -5,10 +5,6 @@ import {
getRedboxSource, getRedboxSource,
} from 'next-test-utils' } from 'next-test-utils'
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('app-dir - server-component-next-dynamic-ssr-false', () => { describe('app-dir - server-component-next-dynamic-ssr-false', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
...@@ -24,10 +20,8 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => { ...@@ -24,10 +20,8 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
expect(redbox.description).toBe('Failed to compile') expect(redbox.description).toBe('Failed to compile')
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed if (process.env.TURBOPACK) {
if (isNewDevOverlay) { expect(redbox.source).toMatchInlineSnapshot(`
if (process.env.TURBOPACK) {
expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js (3:23) "./app/page.js (3:23)
Ecmascript file had an error Ecmascript file had an error
1 | import dynamic from 'next/dynamic' 1 | import dynamic from 'next/dynamic'
...@@ -40,8 +34,8 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => { ...@@ -40,8 +34,8 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
\`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component." \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component."
`) `)
} else { } else {
expect(redbox.source).toMatchInlineSnapshot(` expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js "./app/page.js
Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component. Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component.
,-[3:1] ,-[3:1]
...@@ -54,37 +48,6 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => { ...@@ -54,37 +48,6 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
6 | return <DynamicClient /> 6 | return <DynamicClient />
\`----" \`----"
`) `)
}
} else {
if (process.env.TURBOPACK) {
expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js (3:23)
Ecmascript file had an error
1 | import dynamic from 'next/dynamic'
2 |
> 3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false })
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | export default function Page() {
6 | return <DynamicClient />
\`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component."
`)
} else {
expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js
Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component.
,-[3:1]
1 | import dynamic from 'next/dynamic'
2 |
3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false })
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | export default function Page() {
6 | return <DynamicClient />
\`----"
`)
}
} }
}) })
}) })
...@@ -7,8 +7,6 @@ import { ...@@ -7,8 +7,6 @@ import {
getRedboxSource, getRedboxSource,
} from 'next-test-utils' } from 'next-test-utils'
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const isReactExperimental = process.env.__NEXT_EXPERIMENTAL_PPR === 'true' const isReactExperimental = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18 const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18
...@@ -396,9 +394,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -396,9 +394,7 @@ describe('react-dom/server in React Server environment', () => {
} }
`) `)
} else { } else {
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed expect(redbox).toMatchInlineSnapshot(`
if (isNewDevOverlay) {
expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "Failed to compile", "description": "Failed to compile",
"source": "./app/exports/app-code/react-dom-server-node-implicit/page.js "source": "./app/exports/app-code/react-dom-server-node-implicit/page.js
...@@ -422,32 +418,6 @@ describe('react-dom/server in React Server environment', () => { ...@@ -422,32 +418,6 @@ describe('react-dom/server in React Server environment', () => {
\`----", \`----",
} }
`) `)
} else {
expect(redbox).toMatchInlineSnapshot(`
{
"description": "Failed to compile",
"source": "./app/exports/app-code/react-dom-server-node-implicit/page.js
Error: x You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering
,-[1:1]
1 | import * as ReactDOMServerNode from 'react-dom/server'
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | // Fine to drop once React is on ESM
3 | import ReactDOMServerNodeDefault from 'react-dom/server'
\`----
x You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering
,-[3:1]
1 | import * as ReactDOMServerNode from 'react-dom/server'
2 | // Fine to drop once React is on ESM
3 | import ReactDOMServerNodeDefault from 'react-dom/server'
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | export const runtime = 'nodejs'
\`----",
}
`)
}
} }
}) })
......
...@@ -11,13 +11,8 @@ import { ...@@ -11,13 +11,8 @@ import {
} from 'next-test-utils' } from 'next-test-utils'
import { NextInstance } from 'e2e-utils' import { NextInstance } from 'e2e-utils'
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const installCheckVisible = (browser) => { const installCheckVisible = (browser) => {
if (isNewDevOverlay) { return browser.eval(`(function() {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() { window.checkInterval = setInterval(function() {
const root = document.querySelector('nextjs-portal').shadowRoot; const root = document.querySelector('nextjs-portal').shadowRoot;
const indicator = root.querySelector('[data-next-mark]') const indicator = root.querySelector('[data-next-mark]')
...@@ -27,18 +22,6 @@ const installCheckVisible = (browser) => { ...@@ -27,18 +22,6 @@ const installCheckVisible = (browser) => {
if (window.showedBuilder) clearInterval(window.checkInterval) if (window.showedBuilder) clearInterval(window.checkInterval)
}, 50) }, 50)
})()`) })()`)
} else {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() {
let watcherDiv = document.querySelector('#__next-build-indicator')
watcherDiv = watcherDiv.shadowRoot || watcherDiv
window.showedBuilder = window.showedBuilder || (
watcherDiv.querySelector('div').className.indexOf('visible') > -1
)
if (window.showedBuilder) clearInterval(window.checkInterval)
}, 50)
})()`)
}
} }
describe('GS(S)P Server-Side Change Reloading', () => { describe('GS(S)P Server-Side Change Reloading', () => {
......
...@@ -13,9 +13,6 @@ describe('app-dir - error-on-next-codemod-comment', () => { ...@@ -13,9 +13,6 @@ describe('app-dir - error-on-next-codemod-comment', () => {
skipDeployment: true, skipDeployment: true,
}) })
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
if (isNextDev) { if (isNextDev) {
beforeAll(async () => { beforeAll(async () => {
await next.start() await next.start()
...@@ -26,10 +23,8 @@ describe('app-dir - error-on-next-codemod-comment', () => { ...@@ -26,10 +23,8 @@ describe('app-dir - error-on-next-codemod-comment', () => {
await assertHasRedbox(browser) await assertHasRedbox(browser)
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed if (process.env.TURBOPACK) {
if (isNewDevOverlay) { expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
if (process.env.TURBOPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx (2:2) "./app/page.tsx (2:2)
Ecmascript file had an error Ecmascript file had an error
1 | export default function Page() { 1 | export default function Page() {
...@@ -42,8 +37,8 @@ describe('app-dir - error-on-next-codemod-comment', () => { ...@@ -42,8 +37,8 @@ describe('app-dir - error-on-next-codemod-comment', () => {
You have an unresolved @next/codemod comment "remove jsx of next line" that needs review. You have an unresolved @next/codemod comment "remove jsx of next line" that needs review.
After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can be taken." After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can be taken."
`) `)
} else { } else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx "./app/page.tsx
Error: x You have an unresolved @next/codemod comment "remove jsx of next line" that needs review. Error: x You have an unresolved @next/codemod comment "remove jsx of next line" that needs review.
| After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can | After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can
...@@ -57,38 +52,6 @@ describe('app-dir - error-on-next-codemod-comment', () => { ...@@ -57,38 +52,6 @@ describe('app-dir - error-on-next-codemod-comment', () => {
4 | } 4 | }
\`----" \`----"
`) `)
}
} else {
if (process.env.TURBOPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx (2:2)
Ecmascript file had an error
1 | export default function Page() {
> 2 | // @next-codemod-error remove jsx of next line
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | return <p>hello world</p>
4 | }
5 |
You have an unresolved @next/codemod comment "remove jsx of next line" that needs review.
After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can be taken."
`)
} else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx
Error: x You have an unresolved @next/codemod comment "remove jsx of next line" that needs review.
| After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can
| be taken.
|
,-[2:1]
1 | export default function Page() {
2 | // @next-codemod-error remove jsx of next line
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | return <p>hello world</p>
4 | }
\`----"
`)
}
} }
}) })
......
...@@ -6,9 +6,6 @@ describe('app dir - global error', () => { ...@@ -6,9 +6,6 @@ describe('app dir - global error', () => {
files: __dirname, files: __dirname,
}) })
const isNewOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
it('should trigger error component when an error happens during rendering', async () => { it('should trigger error component when an error happens during rendering', async () => {
const browser = await next.browser('/client') const browser = await next.browser('/client')
await browser await browser
...@@ -33,13 +30,7 @@ describe('app dir - global error', () => { ...@@ -33,13 +30,7 @@ describe('app dir - global error', () => {
if (isNextDev) { if (isNextDev) {
await assertHasRedbox(browser) await assertHasRedbox(browser)
const description = await getRedboxDescription(browser) const description = await getRedboxDescription(browser)
if (isNewOverlay) { expect(description).toMatchInlineSnapshot(`"Error: server page error"`)
expect(description).toMatchInlineSnapshot(`"Error: server page error"`)
} else {
expect(description).toMatchInlineSnapshot(
`"[ Server ] Error: server page error"`
)
}
} }
// Show original error message in dev mode, but hide with the react fallback RSC error message in production mode // Show original error message in dev mode, but hide with the react fallback RSC error message in production mode
expect(await browser.elementByCss('#error').text()).toBe( expect(await browser.elementByCss('#error').text()).toBe(
...@@ -81,13 +72,7 @@ describe('app dir - global error', () => { ...@@ -81,13 +72,7 @@ describe('app dir - global error', () => {
if (isNextDev) { if (isNextDev) {
await assertHasRedbox(browser) await assertHasRedbox(browser)
const description = await getRedboxDescription(browser) const description = await getRedboxDescription(browser)
if (isNewOverlay) { expect(description).toMatchInlineSnapshot(`"Error: Metadata error"`)
expect(description).toMatchInlineSnapshot(`"Error: Metadata error"`)
} else {
expect(description).toMatchInlineSnapshot(
`"[ Server ] Error: Metadata error"`
)
}
} }
expect(await browser.elementByCss('h1').text()).toBe('Global Error') expect(await browser.elementByCss('h1').text()).toBe('Global Error')
expect(await browser.elementByCss('#error').text()).toBe( expect(await browser.elementByCss('#error').text()).toBe(
......
...@@ -17,13 +17,7 @@ describe('app dir - global error - layout error', () => { ...@@ -17,13 +17,7 @@ describe('app dir - global error - layout error', () => {
if (isNextDev) { if (isNextDev) {
await assertHasRedbox(browser) await assertHasRedbox(browser)
const description = await getRedboxDescription(browser) const description = await getRedboxDescription(browser)
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') { expect(description).toMatchInlineSnapshot(`"Error: layout error"`)
expect(description).toMatchInlineSnapshot(`"Error: layout error"`)
} else {
expect(description).toMatchInlineSnapshot(
`"[ Server ] Error: layout error"`
)
}
} }
expect(await browser.elementByCss('h1').text()).toBe('Global Error') expect(await browser.elementByCss('h1').text()).toBe('Global Error')
......
...@@ -18,9 +18,6 @@ describe('use-cache-close-over-function', () => { ...@@ -18,9 +18,6 @@ describe('use-cache-close-over-function', () => {
return return
} }
const isNewOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
if (isNextDev) { if (isNextDev) {
it('should show an error toast for client-side usage', async () => { it('should show an error toast for client-side usage', async () => {
const outputIndex = next.cliOutput.length const outputIndex = next.cliOutput.length
...@@ -31,19 +28,11 @@ describe('use-cache-close-over-function', () => { ...@@ -31,19 +28,11 @@ describe('use-cache-close-over-function', () => {
const errorDescription = await getRedboxDescription(browser) const errorDescription = await getRedboxDescription(browser)
const errorSource = await getRedboxSource(browser) const errorSource = await getRedboxSource(browser)
if (isNewOverlay) { expect(errorDescription).toMatchInlineSnapshot(`
expect(errorDescription).toMatchInlineSnapshot(`
"Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it. "Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
[function fn] [function fn]
^^^^^^^^^^^" ^^^^^^^^^^^"
`) `)
} else {
expect(errorDescription).toMatchInlineSnapshot(`
"[ Prerender ] Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
[function fn]
^^^^^^^^^^^"
`)
}
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"app/client/page.tsx (8:3) @ createCachedFn "app/client/page.tsx (8:3) @ createCachedFn
...@@ -97,19 +86,11 @@ describe('use-cache-close-over-function', () => { ...@@ -97,19 +86,11 @@ describe('use-cache-close-over-function', () => {
const errorDescription = await getRedboxDescription(browser) const errorDescription = await getRedboxDescription(browser)
const errorSource = await getRedboxSource(browser) const errorSource = await getRedboxSource(browser)
if (isNewOverlay) { expect(errorDescription).toMatchInlineSnapshot(`
expect(errorDescription).toMatchInlineSnapshot(`
"Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it. "Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
[function fn] [function fn]
^^^^^^^^^^^" ^^^^^^^^^^^"
`) `)
} else {
expect(errorDescription).toMatchInlineSnapshot(`
"[ Prerender ] Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
[function fn]
^^^^^^^^^^^"
`)
}
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"app/server/page.tsx (6:3) @ createCachedFn "app/server/page.tsx (6:3) @ createCachedFn
......
...@@ -11,8 +11,6 @@ import { ...@@ -11,8 +11,6 @@ import {
import stripAnsi from 'strip-ansi' import stripAnsi from 'strip-ansi'
const isExperimentalReact = process.env.__NEXT_EXPERIMENTAL_PPR const isExperimentalReact = process.env.__NEXT_EXPERIMENTAL_PPR
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const expectedErrorMessage = const expectedErrorMessage =
'Error: Filling a cache during prerender timed out, likely because request-specific arguments such as params, searchParams, cookies() or dynamic data were used inside "use cache".' 'Error: Filling a cache during prerender timed out, likely because request-specific arguments such as params, searchParams, cookies() or dynamic data were used inside "use cache".'
...@@ -43,11 +41,7 @@ describe('use-cache-hanging-inputs', () => { ...@@ -43,11 +41,7 @@ describe('use-cache-hanging-inputs', () => {
const errorDescription = await getRedboxDescription(browser) const errorDescription = await getRedboxDescription(browser)
const errorSource = await getRedboxSource(browser) const errorSource = await getRedboxSource(browser)
if (isNewDevOverlay) { expect(errorDescription).toBe(expectedErrorMessage)
expect(errorDescription).toBe(expectedErrorMessage)
} else {
expect(errorDescription).toBe(`[ Cache ] ${expectedErrorMessage}`)
}
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex)) const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
...@@ -106,11 +100,7 @@ describe('use-cache-hanging-inputs', () => { ...@@ -106,11 +100,7 @@ describe('use-cache-hanging-inputs', () => {
const errorDescription = await getRedboxDescription(browser) const errorDescription = await getRedboxDescription(browser)
const errorSource = await getRedboxSource(browser) const errorSource = await getRedboxSource(browser)
if (isNewDevOverlay) { expect(errorDescription).toBe(expectedErrorMessage)
expect(errorDescription).toBe(expectedErrorMessage)
} else {
expect(errorDescription).toBe(`[ Cache ] ${expectedErrorMessage}`)
}
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex)) const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
...@@ -156,11 +146,7 @@ describe('use-cache-hanging-inputs', () => { ...@@ -156,11 +146,7 @@ describe('use-cache-hanging-inputs', () => {
const errorDescription = await getRedboxDescription(browser) const errorDescription = await getRedboxDescription(browser)
const errorSource = await getRedboxSource(browser) const errorSource = await getRedboxSource(browser)
if (isNewDevOverlay) { expect(errorDescription).toBe(expectedErrorMessage)
expect(errorDescription).toBe(expectedErrorMessage)
} else {
expect(errorDescription).toBe(`[ Cache ] ${expectedErrorMessage}`)
}
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex)) const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
...@@ -217,24 +203,14 @@ describe('use-cache-hanging-inputs', () => { ...@@ -217,24 +203,14 @@ describe('use-cache-hanging-inputs', () => {
const expectedErrorMessagePpr = const expectedErrorMessagePpr =
'Error: Route "/bound-args": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don\'t have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense' 'Error: Route "/bound-args": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don\'t have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense'
if (isNewDevOverlay) { expect(errorDescription).toBe(expectedErrorMessagePpr)
expect(errorDescription).toBe(expectedErrorMessagePpr)
} else {
expect(errorDescription).toBe(
`[ Server ] ${expectedErrorMessagePpr}`
)
}
expect(cliOutput).toContain( expect(cliOutput).toContain(
`${expectedErrorMessagePpr} `${expectedErrorMessagePpr}
at Page [Server] (<anonymous>)` at Page [Server] (<anonymous>)`
) )
} else { } else {
if (isNewDevOverlay) { expect(errorDescription).toBe(expectedErrorMessage)
expect(errorDescription).toBe(expectedErrorMessage)
} else {
expect(errorDescription).toBe(`[ Cache ] ${expectedErrorMessage}`)
}
if (isTurbopack) { if (isTurbopack) {
// TODO(veil): For Turbopack, a fix in the React Flight Client, where // TODO(veil): For Turbopack, a fix in the React Flight Client, where
...@@ -275,19 +251,11 @@ describe('use-cache-hanging-inputs', () => { ...@@ -275,19 +251,11 @@ describe('use-cache-hanging-inputs', () => {
const title = await getRedboxTitle(browser) const title = await getRedboxTitle(browser)
const description = await getRedboxDescription(browser) const description = await getRedboxDescription(browser)
if (isNewDevOverlay) { expect({ count, title, description }).toEqual({
expect({ count, title, description }).toEqual({ count: 1,
count: 1, title: 'Unhandled Runtime Error\nCache',
title: 'Unhandled Runtime Error\nCache', description: 'Error: kaputt!',
description: 'Error: kaputt!', })
})
} else {
expect({ count, title, description }).toEqual({
count: 1,
title: 'Unhandled Runtime Error',
description: '[ Cache ] Error: kaputt!',
})
}
}) })
}) })
} else { } else {
......
...@@ -39,11 +39,7 @@ describe('use-cache-standalone-search-params', () => { ...@@ -39,11 +39,7 @@ describe('use-cache-standalone-search-params', () => {
const errorSource = await getRedboxSource(browser) const errorSource = await getRedboxSource(browser)
const expectedErrorMessage = getExpectedErrorMessage(route) const expectedErrorMessage = getExpectedErrorMessage(route)
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') { expect(errorDescription).toBe(expectedErrorMessage)
expect(errorDescription).toBe(expectedErrorMessage)
} else {
expect(errorDescription).toBe(`[ Cache ] ${expectedErrorMessage}`)
}
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex)) const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
......
...@@ -30,9 +30,6 @@ describe('use-cache-unknown-cache-kind', () => { ...@@ -30,9 +30,6 @@ describe('use-cache-unknown-cache-kind', () => {
return return
} }
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
if (isNextStart) { if (isNextStart) {
beforeAll(async () => { beforeAll(async () => {
await next.build() await next.build()
...@@ -105,10 +102,8 @@ describe('use-cache-unknown-cache-kind', () => { ...@@ -105,10 +102,8 @@ describe('use-cache-unknown-cache-kind', () => {
expect(errorDescription).toBe('Failed to compile') expect(errorDescription).toBe('Failed to compile')
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed if (isTurbopack) {
if (isNewDevOverlay) { expect(errorSource).toMatchInlineSnapshot(`
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1) "./app/page.tsx (1:1)
Ecmascript file had an error Ecmascript file had an error
> 1 | 'use cache: custom' > 1 | 'use cache: custom'
...@@ -119,8 +114,8 @@ describe('use-cache-unknown-cache-kind', () => { ...@@ -119,8 +114,8 @@ describe('use-cache-unknown-cache-kind', () => {
Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config." Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config."
`) `)
} else { } else {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx "./app/page.tsx
Error: x Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config. Error: x Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config.
| |
...@@ -132,34 +127,6 @@ describe('use-cache-unknown-cache-kind', () => { ...@@ -132,34 +127,6 @@ describe('use-cache-unknown-cache-kind', () => {
4 | return <p>hello world</p> 4 | return <p>hello world</p>
\`----" \`----"
`) `)
}
} else {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache: custom'
| ^^^^^^^^^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config."
`)
} else {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx
Error: x Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config.
|
,-[1:1]
1 | 'use cache: custom'
: ^^^^^^^^^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
\`----"
`)
}
} }
}) })
......
...@@ -24,9 +24,6 @@ describe('use-cache-without-experimental-flag', () => { ...@@ -24,9 +24,6 @@ describe('use-cache-without-experimental-flag', () => {
return return
} }
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
if (isNextStart) { if (isNextStart) {
it('should fail the build with an error', async () => { it('should fail the build with an error', async () => {
const { cliOutput } = await next.build() const { cliOutput } = await next.build()
...@@ -89,10 +86,8 @@ describe('use-cache-without-experimental-flag', () => { ...@@ -89,10 +86,8 @@ describe('use-cache-without-experimental-flag', () => {
expect(errorDescription).toBe('Failed to compile') expect(errorDescription).toBe('Failed to compile')
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed if (isTurbopack) {
if (isNewDevOverlay) { expect(errorSource).toMatchInlineSnapshot(`
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1) "./app/page.tsx (1:1)
Ecmascript file had an error Ecmascript file had an error
> 1 | 'use cache' > 1 | 'use cache'
...@@ -105,39 +100,8 @@ describe('use-cache-without-experimental-flag', () => { ...@@ -105,39 +100,8 @@ describe('use-cache-without-experimental-flag', () => {
Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage" Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage"
`) `)
} else {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx
Error: x To use "use cache", please enable the experimental feature flag "useCache" in your Next.js config.
|
| Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage
|
,-[1:1]
1 | 'use cache'
: ^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
\`----"
`)
}
} else { } else {
if (isTurbopack) { expect(errorSource).toMatchInlineSnapshot(`
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache'
| ^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
To use "use cache", please enable the experimental feature flag "useCache" in your Next.js config.
Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage"
`)
} else {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx "./app/page.tsx
Error: x To use "use cache", please enable the experimental feature flag "useCache" in your Next.js config. Error: x To use "use cache", please enable the experimental feature flag "useCache" in your Next.js config.
| |
...@@ -151,7 +115,6 @@ describe('use-cache-without-experimental-flag', () => { ...@@ -151,7 +115,6 @@ describe('use-cache-without-experimental-flag', () => {
4 | return <p>hello world</p> 4 | return <p>hello world</p>
\`----" \`----"
`) `)
}
} }
}) })
......
...@@ -11,13 +11,8 @@ const nextConfig = join(appDir, 'next.config.js') ...@@ -11,13 +11,8 @@ const nextConfig = join(appDir, 'next.config.js')
let appPort let appPort
let app let app
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const installCheckVisible = (browser) => { const installCheckVisible = (browser) => {
if (isNewDevOverlay) { return browser.eval(`(function() {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() { window.checkInterval = setInterval(function() {
const root = document.querySelector('nextjs-portal').shadowRoot; const root = document.querySelector('nextjs-portal').shadowRoot;
const indicator = root.querySelector('[data-next-mark]') const indicator = root.querySelector('[data-next-mark]')
...@@ -27,18 +22,6 @@ const installCheckVisible = (browser) => { ...@@ -27,18 +22,6 @@ const installCheckVisible = (browser) => {
if (window.showedBuilder) clearInterval(window.checkInterval) if (window.showedBuilder) clearInterval(window.checkInterval)
}, 5) }, 5)
})()`) })()`)
} else {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() {
let watcherDiv = document.querySelector('#__next-build-indicator')
watcherDiv = watcherDiv.shadowRoot || watcherDiv
window.showedBuilder = window.showedBuilder || (
watcherDiv.querySelector('div').className.indexOf('visible') > -1
)
if (window.showedBuilder) clearInterval(window.checkInterval)
}, 5)
})()`)
}
} }
describe('Build Activity Indicator', () => { describe('Build Activity Indicator', () => {
...@@ -83,21 +66,6 @@ describe('Build Activity Indicator', () => { ...@@ -83,21 +66,6 @@ describe('Build Activity Indicator', () => {
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
}) })
afterAll(() => killApp(app)) afterAll(() => killApp(app))
// The indicator has no special container in the new dev overlay -
// it's rendered as part of the indicator logo
if (!isNewDevOverlay) {
it('Adds the build indicator container', async () => {
const browser = await webdriver(
appPort,
pagesOrApp === 'pages' ? '/' : '/app'
)
const html = await browser.eval('document.body.innerHTML')
expect(html).toMatch(/__next-build-indicator/)
await browser.close()
})
}
;(process.env.TURBOPACK ? describe.skip : describe)('webpack only', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('webpack only', () => {
it('Shows the build indicator when a page is built during navigation', async () => { it('Shows the build indicator when a page is built during navigation', async () => {
const browser = await webdriver( const browser = await webdriver(
...@@ -135,34 +103,4 @@ describe('Build Activity Indicator', () => { ...@@ -135,34 +103,4 @@ describe('Build Activity Indicator', () => {
await browser.close() await browser.close()
}) })
}) })
describe.each(['pages', 'app'])(
'Disabled with next.config.js - (%s)',
(pagesOrApp) => {
beforeAll(async () => {
await fs.writeFile(
nextConfig,
'module.exports = { devIndicators: { buildActivity: false } }',
'utf8'
)
appPort = await findPort()
app = await launchApp(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
await fs.remove(nextConfig)
})
it('Does not add the build indicator container', async () => {
const browser = await webdriver(
appPort,
pagesOrApp === 'pages' ? '/' : '/app'
)
const html = await browser.eval('document.body.innerHTML')
expect(html).not.toMatch(/__next-build-indicator/)
await browser.close()
})
}
)
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment