fix: codeframe not visible with custom _500.tsx (#1869)

This commit is contained in:
Marvin Hagemeister
2023-10-05 16:29:22 +02:00
committed by GitHub
parent a838a6c733
commit 4044b5be78
8 changed files with 81 additions and 2 deletions
+15 -2
View File
@@ -281,8 +281,21 @@ export async function getServerContext(opts: InternalFreshOptions) {
url,
name,
component,
handler: handler ??
((req, ctx) => router.defaultErrorHandler(req, ctx, ctx.error)),
handler: (req, ctx) => {
if (opts.dev) {
const prevComp = error.component;
error.component = DefaultErrorHandler;
try {
return ctx.render();
} finally {
error.component = prevComp;
}
}
return handler
? handler(req, ctx)
: router.defaultErrorHandler(req, ctx, ctx.error);
},
csp: Boolean(config?.csp ?? false),
appWrapper: !config?.skipAppWrapper,
inheritLayouts: !config?.skipInheritedLayouts,