Skip to content

Commit

Permalink
Open in fullscreen if server layer found in stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Bornö committed Dec 9, 2022
1 parent e8f8a99 commit 70ba97f
Showing 1 changed file with 13 additions and 1 deletion.
Expand Up @@ -14,6 +14,10 @@ import { CssReset } from './styles/CssReset'
import { parseStack } from './helpers/parseStack'
import { RootLayoutError } from './container/RootLayoutError'

function isServerComponentError(error: Error): boolean {
return !!error.stack?.includes('webpack-internal:///(sc_server)/')
}

interface ReactDevOverlayState {
reactError: SupportedErrorEvent | null
}
Expand Down Expand Up @@ -76,7 +80,15 @@ class ReactDevOverlay extends React.PureComponent<
) : hasBuildError ? (
<BuildError message={state.buildError!} />
) : hasRuntimeErrors ? (
<Errors initialDisplayState="minimized" errors={state.errors} />
<Errors
initialDisplayState={
// If the error occured in a server component render, open up the overlay in fullscreen mode
isServerComponentError(state.errors[0].event?.reason)
? 'fullscreen'
: 'minimized'
}
errors={state.errors}
/>
) : reactError ? (
<Errors initialDisplayState="fullscreen" errors={[reactError]} />
) : undefined}
Expand Down

0 comments on commit 70ba97f

Please sign in to comment.