Unverified Commit bd72f39c authored by Will Binns-Smith's avatar Will Binns-Smith Committed by GitHub

Turbopack + pages router: recover from runtime errors by reloading (#63024)

An iteration of #62359, this uses the module-local flag instead of a
shared dedicated module for flagging runtime errors, correctly reloading
the page when these occur.

Test Plan: See now-passing tests in the manifest.


Closes PACK-2690
parent 8c7f0dc9
......@@ -45,7 +45,6 @@ import type {
TurbopackMsgToBrowser,
} from '../../../server/dev/hot-reloader-types'
import { extractModulesFromTurbopackMessage } from '../../../server/dev/extract-modules-from-turbopack-message'
import { RuntimeErrorHandler } from '../../components/react-dev-overlay/internal/helpers/runtime-error-handler'
import { REACT_REFRESH_FULL_RELOAD_FROM_ERROR } from './messages'
// This alternative WebpackDevServer combines the functionality of:
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
......@@ -346,7 +345,7 @@ function processMessage(obj: HMR_ACTION_TYPES) {
data: obj.data,
})
}
if (RuntimeErrorHandler.hadRuntimeError) {
if (hadRuntimeError) {
console.warn(REACT_REFRESH_FULL_RELOAD_FROM_ERROR)
performFullReload(null)
}
......
......@@ -1558,6 +1558,7 @@
"basic HMR, basePath: \"\" Error Recovery should recover after undefined exported as default",
"basic HMR, basePath: \"\" Error Recovery should recover from 404 after a page has been added",
"basic HMR, basePath: \"\" Error Recovery should recover from 404 after a page has been added with dynamic segments",
"basic HMR, basePath: \"\" Error Recovery should recover from errors in getInitialProps in client",
"basic HMR, basePath: \"\" Hot Module Reloading delete a page and add it back should load the page properly",
"basic HMR, basePath: \"\" Hot Module Reloading editing a page should detect the changes and display it",
"basic HMR, basePath: \"\" Hot Module Reloading editing a page should not reload unrelated pages",
......@@ -1578,6 +1579,7 @@
"basic HMR, basePath: \"/docs\" Error Recovery should recover after undefined exported as default",
"basic HMR, basePath: \"/docs\" Error Recovery should recover from 404 after a page has been added",
"basic HMR, basePath: \"/docs\" Error Recovery should recover from 404 after a page has been added with dynamic segments",
"basic HMR, basePath: \"/docs\" Error Recovery should recover from errors in getInitialProps in client",
"basic HMR, basePath: \"/docs\" Hot Module Reloading delete a page and add it back should load the page properly",
"basic HMR, basePath: \"/docs\" Hot Module Reloading editing a page should detect the changes and display it",
"basic HMR, basePath: \"/docs\" Hot Module Reloading editing a page should not reload unrelated pages",
......@@ -1591,12 +1593,10 @@
],
"failed": [
"basic HMR, basePath: \"\" Error Recovery should recover after webpack parse error in an imported file",
"basic HMR, basePath: \"\" Error Recovery should recover from errors in getInitialProps in client",
"basic HMR, basePath: \"\" Error Recovery should recover from errors in the render function",
"basic HMR, basePath: \"\" Full reload should warn about full reload in cli output - anonymous page function",
"basic HMR, basePath: \"\" Full reload should warn about full reload in cli output - runtime-error",
"basic HMR, basePath: \"/docs\" Error Recovery should recover after webpack parse error in an imported file",
"basic HMR, basePath: \"/docs\" Error Recovery should recover from errors in getInitialProps in client",
"basic HMR, basePath: \"/docs\" Error Recovery should recover from errors in the render function",
"basic HMR, basePath: \"/docs\" Full reload should warn about full reload in cli output - anonymous page function",
"basic HMR, basePath: \"/docs\" Full reload should warn about full reload in cli output - runtime-error"
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