Unverified Commit 2d185084 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[devtools] Wrap overlay in Activity (#89818)

This allows rendering the overlay in the background at a lower priority while it's hidden.

Part of a larger refactor how we sourcemap errors. The end-goal is to lazily do the sourcemapping with some prefetching which should make the overlay more responsive for many errors or errors in modules with large sourcemaps or source content.
parent 61672d96
......@@ -4,7 +4,7 @@ import {
type OverlayState,
} from '../../../shared'
import { Suspense } from 'react'
import { Activity } from 'react'
import { BuildError } from '../../../container/build-error'
import { Errors } from '../../../container/errors'
import { useDelayedRender } from '../../../hooks/use-delayed-render'
......@@ -62,26 +62,20 @@ export function ErrorOverlay({
// No Runtime Errors.
if (!runtimeErrors.length) {
// Workaround React quirk that triggers "Switch to client-side rendering" if
// we return no Suspense boundary here.
return <Suspense />
}
if (!mounted) {
// Workaround React quirk that triggers "Switch to client-side rendering" if
// we return no Suspense boundary here.
return <Suspense />
return null
}
return (
<Errors
{...commonProps}
debugInfo={state.debugInfo}
getSquashedHydrationErrorDetails={getSquashedHydrationErrorDetails}
runtimeErrors={runtimeErrors}
onClose={() => {
dispatch({ type: ACTION_ERROR_OVERLAY_CLOSE })
}}
/>
<Activity mode={mounted ? 'visible' : 'hidden'}>
<Errors
{...commonProps}
debugInfo={state.debugInfo}
getSquashedHydrationErrorDetails={getSquashedHydrationErrorDetails}
runtimeErrors={runtimeErrors}
onClose={() => {
dispatch({ type: ACTION_ERROR_OVERLAY_CLOSE })
}}
/>
</Activity>
)
}
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