diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/attach-hydration-error-state.ts b/packages/next/src/client/components/errors/attach-hydration-error-state.ts similarity index 97% rename from packages/next/src/client/components/react-dev-overlay/internal/helpers/attach-hydration-error-state.ts rename to packages/next/src/client/components/errors/attach-hydration-error-state.ts index 9cb6758344573..9c282fef14aed 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/helpers/attach-hydration-error-state.ts +++ b/packages/next/src/client/components/errors/attach-hydration-error-state.ts @@ -1,7 +1,7 @@ import { isHydrationError, getDefaultHydrationErrorMessage, -} from '../../../is-hydration-error' +} from '../is-hydration-error' import { hydrationErrorState, getReactHydrationDiffSegments, diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/console-error.ts b/packages/next/src/client/components/errors/console-error.ts similarity index 100% rename from packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/console-error.ts rename to packages/next/src/client/components/errors/console-error.ts diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/enqueue-client-error.ts b/packages/next/src/client/components/errors/enqueue-client-error.ts similarity index 92% rename from packages/next/src/client/components/react-dev-overlay/internal/helpers/enqueue-client-error.ts rename to packages/next/src/client/components/errors/enqueue-client-error.ts index bc1009207eabe..6f394a6cfdcc3 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/helpers/enqueue-client-error.ts +++ b/packages/next/src/client/components/errors/enqueue-client-error.ts @@ -1,4 +1,4 @@ -import { isHydrationError } from '../../../is-hydration-error' +import { isHydrationError } from '../is-hydration-error' // Dedupe the two consecutive errors: If the previous one is same as current one, ignore the current one. export function enqueueConsecutiveDedupedError( diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts b/packages/next/src/client/components/errors/hydration-error-info.ts similarity index 98% rename from packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts rename to packages/next/src/client/components/errors/hydration-error-info.ts index 3ca474eeedb1a..633fed4e60cc0 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts +++ b/packages/next/src/client/components/errors/hydration-error-info.ts @@ -1,4 +1,4 @@ -import { getHydrationErrorStackInfo } from '../../../is-hydration-error' +import { getHydrationErrorStackInfo } from '../is-hydration-error' export type HydrationErrorState = { // Hydration warning template format: diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/runtime-error-handler.ts b/packages/next/src/client/components/errors/runtime-error-handler.ts similarity index 100% rename from packages/next/src/client/components/react-dev-overlay/internal/helpers/runtime-error-handler.ts rename to packages/next/src/client/components/errors/runtime-error-handler.ts diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/stitched-error.ts b/packages/next/src/client/components/errors/stitched-error.ts similarity index 96% rename from packages/next/src/client/components/react-dev-overlay/internal/helpers/stitched-error.ts rename to packages/next/src/client/components/errors/stitched-error.ts index b4ee634169e27..cfed44f3cd052 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/helpers/stitched-error.ts +++ b/packages/next/src/client/components/errors/stitched-error.ts @@ -1,5 +1,5 @@ import React from 'react' -import isError from '../../../../../lib/is-error' +import isError from '../../../lib/is-error' const REACT_ERROR_STACK_BOTTOM_FRAME = 'react-stack-bottom-frame' const REACT_ERROR_STACK_BOTTOM_FRAME_REGEX = new RegExp( diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/use-error-handler.ts b/packages/next/src/client/components/errors/use-error-handler.ts similarity index 93% rename from packages/next/src/client/components/react-dev-overlay/internal/helpers/use-error-handler.ts rename to packages/next/src/client/components/errors/use-error-handler.ts index a7ad315cc6bed..c09c7a8d24359 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/helpers/use-error-handler.ts +++ b/packages/next/src/client/components/errors/use-error-handler.ts @@ -1,12 +1,12 @@ import { useEffect } from 'react' import { attachHydrationErrorState } from './attach-hydration-error-state' -import { isNextRouterError } from '../../../is-next-router-error' +import { isNextRouterError } from '../is-next-router-error' import { storeHydrationErrorStateFromConsoleArgs } from './hydration-error-info' -import { formatConsoleArgs } from '../../../../lib/console' -import isError from '../../../../../lib/is-error' +import { formatConsoleArgs } from '../../lib/console' +import isError from '../../../lib/is-error' import { createUnhandledError } from './console-error' import { enqueueConsecutiveDedupedError } from './enqueue-client-error' -import { getReactStitchedError } from './stitched-error' +import { getReactStitchedError } from '../errors/stitched-error' const queueMicroTask = globalThis.queueMicrotask || ((cb: () => void) => Promise.resolve().then(cb)) diff --git a/packages/next/src/client/components/globals/handle-global-errors.ts b/packages/next/src/client/components/globals/handle-global-errors.ts index 69fedce605ca5..691bd76748710 100644 --- a/packages/next/src/client/components/globals/handle-global-errors.ts +++ b/packages/next/src/client/components/globals/handle-global-errors.ts @@ -1,3 +1,3 @@ -import { handleGlobalErrors } from '../react-dev-overlay/internal/helpers/use-error-handler' +import { handleGlobalErrors } from '../errors/use-error-handler' handleGlobalErrors() diff --git a/packages/next/src/client/components/globals/intercept-console-error.ts b/packages/next/src/client/components/globals/intercept-console-error.ts index 38c5e7035bdd3..a6d999d8ec256 100644 --- a/packages/next/src/client/components/globals/intercept-console-error.ts +++ b/packages/next/src/client/components/globals/intercept-console-error.ts @@ -1,6 +1,6 @@ import isError from '../../../lib/is-error' import { isNextRouterError } from '../is-next-router-error' -import { handleClientError } from '../react-dev-overlay/internal/helpers/use-error-handler' +import { handleClientError } from '../errors/use-error-handler' export const originConsoleError = window.console.error diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/container/Errors.tsx b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/container/Errors.tsx index 115ce814181dc..ce26b5adac913 100644 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/container/Errors.tsx +++ b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/container/Errors.tsx @@ -18,11 +18,11 @@ import { PseudoHtmlDiff } from './RuntimeError/component-stack-pseudo-html' import { type HydrationErrorState, getHydrationWarningType, -} from '../helpers/hydration-error-info' +} from '../../../../errors/hydration-error-info' import { getUnhandledErrorType, isUnhandledConsoleOrRejection, -} from '../helpers/console-error' +} from '../../../../errors/console-error' import { extractNextErrorCode } from '../../../../../../lib/error-telemetry-utils' import { DevToolsIndicator } from '../components/Errors/dev-tools-indicator/dev-tools-indicator' import { ErrorOverlayLayout } from '../components/Errors/error-overlay-layout/error-overlay-layout' diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/attach-hydration-error-state.ts b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/attach-hydration-error-state.ts deleted file mode 100644 index 8ee6c80c707be..0000000000000 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/attach-hydration-error-state.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { - isHydrationError, - getDefaultHydrationErrorMessage, -} from '../../../../is-hydration-error' -import { - hydrationErrorState, - getReactHydrationDiffSegments, -} from './hydration-error-info' - -export function attachHydrationErrorState(error: Error) { - if ( - isHydrationError(error) && - !error.message.includes( - 'https://nextjs.org/docs/messages/react-hydration-error' - ) - ) { - const reactHydrationDiffSegments = getReactHydrationDiffSegments( - error.message - ) - let parsedHydrationErrorState: typeof hydrationErrorState = {} - if (reactHydrationDiffSegments) { - parsedHydrationErrorState = { - ...(error as any).details, - ...hydrationErrorState, - warning: hydrationErrorState.warning || [ - getDefaultHydrationErrorMessage(), - ], - notes: reactHydrationDiffSegments[0], - reactOutputComponentDiff: reactHydrationDiffSegments[1], - } - } else { - // If there's any extra information in the error message to display, - // append it to the error message details property - if (hydrationErrorState.warning) { - // The patched console.error found hydration errors logged by React - // Append the logged warning to the error message - parsedHydrationErrorState = { - ...(error as any).details, - // It contains the warning, component stack, server and client tag names - ...hydrationErrorState, - } - } - } - ;(error as any).details = parsedHydrationErrorState - } -} diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/enqueue-client-error.ts b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/enqueue-client-error.ts deleted file mode 100644 index 8e2df164dddd2..0000000000000 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/enqueue-client-error.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { isHydrationError } from '../../../../is-hydration-error' - -// Dedupe the two consecutive errors: If the previous one is same as current one, ignore the current one. -export function enqueueConsecutiveDedupedError( - queue: Array, - error: Error -) { - const isFront = isHydrationError(error) - const previousError = isFront ? queue[0] : queue[queue.length - 1] - // Compare the error stack to dedupe the consecutive errors - if (previousError && previousError.stack === error.stack) { - return - } - // TODO: change all to push error into errorQueue, - // currently there's a async api error is always erroring while hydration error showing up. - // Move hydration error to the front of the queue to unblock. - if (isFront) { - queue.unshift(error) - } else { - queue.push(error) - } -} diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/hydration-error-info.ts b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/hydration-error-info.ts deleted file mode 100644 index 0b1fbb6389169..0000000000000 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/hydration-error-info.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { getHydrationErrorStackInfo } from '../../../../is-hydration-error' - -export type HydrationErrorState = { - // Hydration warning template format: - warning?: [string, string, string] - componentStack?: string - serverContent?: string - clientContent?: string - // React 19 hydration diff format: - notes?: string - reactOutputComponentDiff?: string -} - -type NullableText = string | null | undefined - -export const hydrationErrorState: HydrationErrorState = {} - -// https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference -const htmlTagsWarnings = new Set([ - 'Warning: In HTML, %s cannot be a child of <%s>.%s\nThis will cause a hydration error.%s', - 'Warning: In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s', - 'Warning: In HTML, text nodes cannot be a child of <%s>.\nThis will cause a hydration error.', - "Warning: In HTML, whitespace text nodes cannot be a child of <%s>. Make sure you don't have any extra whitespace between tags on each line of your source code.\nThis will cause a hydration error.", - 'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s', - 'Warning: Did not expect server HTML to contain a <%s> in <%s>.%s', -]) -const textAndTagsMismatchWarnings = new Set([ - 'Warning: Expected server HTML to contain a matching text node for "%s" in <%s>.%s', - 'Warning: Did not expect server HTML to contain the text node "%s" in <%s>.%s', -]) -const textMismatchWarning = - 'Warning: Text content did not match. Server: "%s" Client: "%s"%s' - -export const getHydrationWarningType = ( - message: NullableText -): 'tag' | 'text' | 'text-in-tag' => { - if (typeof message !== 'string') { - // TODO: Doesn't make sense to treat no message as a hydration error message. - // We should bail out somewhere earlier. - return 'text' - } - - const normalizedMessage = message.startsWith('Warning: ') - ? message - : `Warning: ${message}` - - if (isHtmlTagsWarning(normalizedMessage)) return 'tag' - if (isTextInTagsMismatchWarning(normalizedMessage)) return 'text-in-tag' - - return 'text' -} - -const isHtmlTagsWarning = (message: string) => htmlTagsWarnings.has(message) - -const isTextMismatchWarning = (message: string) => - textMismatchWarning === message -const isTextInTagsMismatchWarning = (msg: string) => - textAndTagsMismatchWarnings.has(msg) - -const isKnownHydrationWarning = (message: NullableText) => { - if (typeof message !== 'string') { - return false - } - // React 18 has the `Warning: ` prefix. - // React 19 does not. - const normalizedMessage = message.startsWith('Warning: ') - ? message - : `Warning: ${message}` - - return ( - isHtmlTagsWarning(normalizedMessage) || - isTextInTagsMismatchWarning(normalizedMessage) || - isTextMismatchWarning(normalizedMessage) - ) -} - -export const getReactHydrationDiffSegments = (msg: NullableText) => { - if (msg) { - const { message, diff } = getHydrationErrorStackInfo(msg) - if (message) return [message, diff] - } - return undefined -} - -/** - * Patch console.error to capture hydration errors. - * If any of the knownHydrationWarnings are logged, store the message and component stack. - * When the hydration runtime error is thrown, the message and component stack are added to the error. - * This results in a more helpful error message in the error overlay. - */ - -export function storeHydrationErrorStateFromConsoleArgs(...args: any[]) { - const [msg, serverContent, clientContent, componentStack] = args - if (isKnownHydrationWarning(msg)) { - hydrationErrorState.warning = [ - // remove the last %s from the message - msg, - serverContent, - clientContent, - ] - hydrationErrorState.componentStack = componentStack - hydrationErrorState.serverContent = serverContent - hydrationErrorState.clientContent = clientContent - } -} diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/stitched-error.ts b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/stitched-error.ts deleted file mode 100644 index fbe2ba6f2d7f8..0000000000000 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/stitched-error.ts +++ /dev/null @@ -1,49 +0,0 @@ -import React from 'react' -import isError from '../../../../../../lib/is-error' - -const REACT_ERROR_STACK_BOTTOM_FRAME = 'react-stack-bottom-frame' -const REACT_ERROR_STACK_BOTTOM_FRAME_REGEX = new RegExp( - `(at ${REACT_ERROR_STACK_BOTTOM_FRAME} )|(${REACT_ERROR_STACK_BOTTOM_FRAME}\\@)` -) - -const captureOwnerStack = (React as any).captureOwnerStack - ? (React as any).captureOwnerStack - : () => '' - -export function getReactStitchedError(err: T): Error | T { - if (typeof (React as any).captureOwnerStack !== 'function') { - return err - } - const isErrorInstance = isError(err) - const originStack = isErrorInstance ? err.stack || '' : '' - const originMessage = isErrorInstance ? err.message : '' - const stackLines = originStack.split('\n') - const indexOfSplit = stackLines.findIndex((line) => - REACT_ERROR_STACK_BOTTOM_FRAME_REGEX.test(line) - ) - const isOriginalReactError = indexOfSplit >= 0 // has the react-stack-bottom-frame - let newStack = isOriginalReactError - ? stackLines.slice(0, indexOfSplit).join('\n') - : originStack - - const newError = new Error(originMessage) - // Copy all enumerable properties, e.g. digest - Object.assign(newError, err) - newError.stack = newStack - - // Avoid duplicate overriding stack frames - appendOwnerStack(newError) - - return newError -} - -function appendOwnerStack(error: Error) { - let stack = error.stack || '' - // Avoid duplicate overriding stack frames - const ownerStack = captureOwnerStack() - if (ownerStack && stack.endsWith(ownerStack) === false) { - stack += ownerStack - // Override stack - error.stack = stack - } -} diff --git a/packages/next/src/client/components/react-dev-overlay/app/OldReactDevOverlay.tsx b/packages/next/src/client/components/react-dev-overlay/app/OldReactDevOverlay.tsx index def9d8db35352..b16971ffed495 100644 --- a/packages/next/src/client/components/react-dev-overlay/app/OldReactDevOverlay.tsx +++ b/packages/next/src/client/components/react-dev-overlay/app/OldReactDevOverlay.tsx @@ -9,7 +9,7 @@ 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 '../internal/helpers/runtime-error-handler' +import { RuntimeErrorHandler } from '../../errors/runtime-error-handler' interface ReactDevOverlayState { isReactError: boolean diff --git a/packages/next/src/client/components/react-dev-overlay/app/hot-reloader-client.tsx b/packages/next/src/client/components/react-dev-overlay/app/hot-reloader-client.tsx index 0b1a2dc339362..2b027edd4c8b4 100644 --- a/packages/next/src/client/components/react-dev-overlay/app/hot-reloader-client.tsx +++ b/packages/next/src/client/components/react-dev-overlay/app/hot-reloader-client.tsx @@ -24,8 +24,8 @@ import { } from '../shared' import { parseStack } from '../internal/helpers/parse-stack' import ReactDevOverlay from './ReactDevOverlay' -import { useErrorHandler } from '../internal/helpers/use-error-handler' -import { RuntimeErrorHandler } from '../internal/helpers/runtime-error-handler' +import { useErrorHandler } from '../../errors/use-error-handler' +import { RuntimeErrorHandler } from '../../errors/runtime-error-handler' import { useSendMessage, useTurbopack, @@ -41,10 +41,10 @@ import type { } from '../../../../server/dev/hot-reloader-types' import { extractModulesFromTurbopackMessage } from '../../../../server/dev/extract-modules-from-turbopack-message' import { REACT_REFRESH_FULL_RELOAD_FROM_ERROR } from '../shared' -import type { HydrationErrorState } from '../internal/helpers/hydration-error-info' +import type { HydrationErrorState } from '../../errors/hydration-error-info' import type { DebugInfo } from '../types' import { useUntrackedPathname } from '../../navigation-untracked' -import { getReactStitchedError } from '../internal/helpers/stitched-error' +import { getReactStitchedError } from '../../errors/stitched-error' import { shouldRenderRootLevelErrorOverlay } from '../../../lib/is-error-thrown-while-rendering-rsc' import { handleDevBuildIndicatorHmrEvents } from '../../../dev/dev-build-indicator/internal/handle-dev-build-indicator-hmr-events' diff --git a/packages/next/src/client/components/react-dev-overlay/internal/container/Errors.tsx b/packages/next/src/client/components/react-dev-overlay/internal/container/Errors.tsx index b617d0fcdc105..c46ac62bc2198 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/container/Errors.tsx +++ b/packages/next/src/client/components/react-dev-overlay/internal/container/Errors.tsx @@ -28,13 +28,13 @@ import { PseudoHtmlDiff } from './RuntimeError/component-stack-pseudo-html' import { type HydrationErrorState, getHydrationWarningType, -} from '../helpers/hydration-error-info' +} from '../../../errors/hydration-error-info' import { NodejsInspectorCopyButton } from '../components/nodejs-inspector' import { CopyButton } from '../components/copy-button' import { getUnhandledErrorType, isUnhandledConsoleOrRejection, -} from '../helpers/console-error' +} from '../../../errors/console-error' import { extractNextErrorCode } from '../../../../../lib/error-telemetry-utils' export type SupportedErrorEvent = { diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/console-error.ts b/packages/next/src/client/components/react-dev-overlay/internal/helpers/console-error.ts deleted file mode 100644 index 225452dcc4abd..0000000000000 --- a/packages/next/src/client/components/react-dev-overlay/internal/helpers/console-error.ts +++ /dev/null @@ -1,29 +0,0 @@ -// To distinguish from React error.digest, we use a different symbol here to determine if the error is from console.error or unhandled promise rejection. -const digestSym = Symbol.for('next.console.error.digest') -const consoleTypeSym = Symbol.for('next.console.error.type') - -// Represent non Error shape unhandled promise rejections or console.error errors. -// Those errors will be captured and displayed in Error Overlay. -type UnhandledError = Error & { - [digestSym]: 'NEXT_UNHANDLED_ERROR' - [consoleTypeSym]: 'string' | 'error' -} - -export function createUnhandledError(message: string | Error): UnhandledError { - const error = ( - typeof message === 'string' ? new Error(message) : message - ) as UnhandledError - error[digestSym] = 'NEXT_UNHANDLED_ERROR' - error[consoleTypeSym] = typeof message === 'string' ? 'string' : 'error' - return error -} - -export const isUnhandledConsoleOrRejection = ( - error: any -): error is UnhandledError => { - return error && error[digestSym] === 'NEXT_UNHANDLED_ERROR' -} - -export const getUnhandledErrorType = (error: UnhandledError) => { - return error[consoleTypeSym] -} diff --git a/packages/next/src/client/components/react-dev-overlay/pages/client.ts b/packages/next/src/client/components/react-dev-overlay/pages/client.ts index 69f4f997166a8..c549a796a7d26 100644 --- a/packages/next/src/client/components/react-dev-overlay/pages/client.ts +++ b/packages/next/src/client/components/react-dev-overlay/pages/client.ts @@ -4,7 +4,7 @@ import { parseComponentStack } from '../internal/helpers/parse-component-stack' import { hydrationErrorState, storeHydrationErrorStateFromConsoleArgs, -} from '../internal/helpers/hydration-error-info' +} from '../../errors/hydration-error-info' import { ACTION_BEFORE_REFRESH, ACTION_BUILD_ERROR, @@ -15,7 +15,7 @@ import { ACTION_VERSION_INFO, } from '../shared' import type { VersionInfo } from '../../../../server/dev/parse-version-info' -import { attachHydrationErrorState } from '../internal/helpers/attach-hydration-error-state' +import { attachHydrationErrorState } from '../../errors/attach-hydration-error-state' let isRegistered = false let stackTraceLimit: number | undefined = undefined diff --git a/packages/next/src/client/components/react-dev-overlay/pages/hot-reloader-client.ts b/packages/next/src/client/components/react-dev-overlay/pages/hot-reloader-client.ts index 748ef35f2384c..636b9d943ebce 100644 --- a/packages/next/src/client/components/react-dev-overlay/pages/hot-reloader-client.ts +++ b/packages/next/src/client/components/react-dev-overlay/pages/hot-reloader-client.ts @@ -46,7 +46,7 @@ import type { } from '../../../../server/dev/hot-reloader-types' import { extractModulesFromTurbopackMessage } from '../../../../server/dev/extract-modules-from-turbopack-message' import { REACT_REFRESH_FULL_RELOAD_FROM_ERROR } from '../shared' -import { RuntimeErrorHandler } from '../internal/helpers/runtime-error-handler' +import { RuntimeErrorHandler } from '../../errors/runtime-error-handler' // This alternative WebpackDevServer combines the functionality of: // https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js // https://github.com/webpack/webpack/blob/webpack-1/hot/dev-server.js diff --git a/packages/next/src/client/page-bootstrap.ts b/packages/next/src/client/page-bootstrap.ts index 54c5f49405e12..db50a3684071e 100644 --- a/packages/next/src/client/page-bootstrap.ts +++ b/packages/next/src/client/page-bootstrap.ts @@ -11,7 +11,7 @@ import { urlQueryToSearchParams, } from '../shared/lib/router/utils/querystring' import { HMR_ACTIONS_SENT_TO_BROWSER } from '../server/dev/hot-reloader-types' -import { RuntimeErrorHandler } from './components/react-dev-overlay/internal/helpers/runtime-error-handler' +import { RuntimeErrorHandler } from './components/errors/runtime-error-handler' import { REACT_REFRESH_FULL_RELOAD_FROM_ERROR } from './components/react-dev-overlay/shared' import { performFullReload } from './components/react-dev-overlay/pages/hot-reloader-client' import { initializeDevBuildIndicatorForPageRouter } from './dev/dev-build-indicator/initialize-for-page-router' diff --git a/packages/next/src/client/react-client-callbacks/error-boundary-callbacks.ts b/packages/next/src/client/react-client-callbacks/error-boundary-callbacks.ts index 099769656ad14..ceba2be7b8aba 100644 --- a/packages/next/src/client/react-client-callbacks/error-boundary-callbacks.ts +++ b/packages/next/src/client/react-client-callbacks/error-boundary-callbacks.ts @@ -1,8 +1,8 @@ // This file is only used in app router due to the specific error state handling. import type { HydrationOptions } from 'react-dom/client' -import { getReactStitchedError } from '../components/react-dev-overlay/internal/helpers/stitched-error' -import { handleClientError } from '../components/react-dev-overlay/internal/helpers/use-error-handler' +import { getReactStitchedError } from '../components/errors/stitched-error' +import { handleClientError } from '../components/errors/use-error-handler' import { isNextRouterError } from '../components/is-next-router-error' import { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr' import { reportGlobalError } from './report-global-error' diff --git a/packages/next/src/client/react-client-callbacks/on-recoverable-error.ts b/packages/next/src/client/react-client-callbacks/on-recoverable-error.ts index 9347e75a89fd2..a5805eea4fbc2 100644 --- a/packages/next/src/client/react-client-callbacks/on-recoverable-error.ts +++ b/packages/next/src/client/react-client-callbacks/on-recoverable-error.ts @@ -3,7 +3,7 @@ import type { HydrationOptions } from 'react-dom/client' import { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr' import { reportGlobalError } from './report-global-error' -import { getReactStitchedError } from '../components/react-dev-overlay/internal/helpers/stitched-error' +import { getReactStitchedError } from '../components/errors/stitched-error' import isError from '../../lib/is-error' export const onRecoverableError: HydrationOptions['onRecoverableError'] = (