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 { ...@@ -4,7 +4,7 @@ import {
type OverlayState, type OverlayState,
} from '../../../shared' } from '../../../shared'
import { Suspense } from 'react' import { Activity } from 'react'
import { BuildError } from '../../../container/build-error' import { BuildError } from '../../../container/build-error'
import { Errors } from '../../../container/errors' import { Errors } from '../../../container/errors'
import { useDelayedRender } from '../../../hooks/use-delayed-render' import { useDelayedRender } from '../../../hooks/use-delayed-render'
...@@ -62,26 +62,20 @@ export function ErrorOverlay({ ...@@ -62,26 +62,20 @@ export function ErrorOverlay({
// No Runtime Errors. // No Runtime Errors.
if (!runtimeErrors.length) { if (!runtimeErrors.length) {
// Workaround React quirk that triggers "Switch to client-side rendering" if return null
// 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 ( return (
<Errors <Activity mode={mounted ? 'visible' : 'hidden'}>
{...commonProps} <Errors
debugInfo={state.debugInfo} {...commonProps}
getSquashedHydrationErrorDetails={getSquashedHydrationErrorDetails} debugInfo={state.debugInfo}
runtimeErrors={runtimeErrors} getSquashedHydrationErrorDetails={getSquashedHydrationErrorDetails}
onClose={() => { runtimeErrors={runtimeErrors}
dispatch({ type: ACTION_ERROR_OVERLAY_CLOSE }) 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