mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 00:05:51 +00:00
fix: 添加 React Error Boundary 防止生产环境渲染崩溃
增强 SentryErrorBoundary 组件,捕获渲染错误时输出诊断信息 (错误消息 + component stack)到 stderr 和终端,而非静默返回 null。在 replLauncher 根节点和 Messages 组件层级包裹 Error Boundary,防止 Ink 内部的 Error Boundary 直接终止进程。 Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
This commit is contained in:
@@ -18,11 +18,14 @@ export async function launchRepl(
|
||||
renderAndRun: (root: Root, element: React.ReactNode) => Promise<void>,
|
||||
): Promise<void> {
|
||||
const { App } = await import('./components/App.js');
|
||||
const { SentryErrorBoundary } = await import('./components/SentryErrorBoundary.js');
|
||||
const { REPL } = await import('./screens/REPL.js');
|
||||
await renderAndRun(
|
||||
root,
|
||||
<App {...appProps}>
|
||||
<REPL {...replProps} />
|
||||
</App>,
|
||||
<SentryErrorBoundary name="RootREPLBoundary">
|
||||
<App {...appProps}>
|
||||
<REPL {...replProps} />
|
||||
</App>
|
||||
</SentryErrorBoundary>,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user