From bfd36985a7cc0baf4ce0e33de8502b9d408f6fc9 Mon Sep 17 00:00:00 2001
From: WuMingDao <146366930+WuMingDao@users.noreply.github.com>
Date: Thu, 18 Sep 2025 11:30:26 +0800
Subject: [PATCH 1/2] docs(cn): translate panicThreshold.md into Chinese
[translate page of link](https://zh-hans.react.dev/reference/react-compiler/panicThreshold)
---
.../react-compiler/panicThreshold.md | 54 +++++++++----------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/content/reference/react-compiler/panicThreshold.md b/src/content/reference/react-compiler/panicThreshold.md
index e20f5c0c50..6f8ea2b88a 100644
--- a/src/content/reference/react-compiler/panicThreshold.md
+++ b/src/content/reference/react-compiler/panicThreshold.md
@@ -4,13 +4,13 @@ title: panicThreshold
-The `panicThreshold` option controls how the React Compiler handles errors during compilation.
+ `panicThreshold` 选项用于控制 React 编译器在编译过程中如何处理错误。
```js
{
- panicThreshold: 'none' // Recommended
+ panicThreshold: 'none' // 推荐
}
```
@@ -18,42 +18,42 @@ The `panicThreshold` option controls how the React Compiler handles errors durin
---
-## Reference {/*reference*/}
+## 参考 {/*reference*/}
### `panicThreshold` {/*panicthreshold*/}
-Determines whether compilation errors should fail the build or skip optimization.
+决定编译错误是导致构建失败,还是仅跳过优化。
-#### Type {/*type*/}
+#### 类型 {/*type*/}
```
'none' | 'critical_errors' | 'all_errors'
```
-#### Default value {/*default-value*/}
+#### 默认值 {/*default-value*/}
`'none'`
-#### Options {/*options*/}
+#### 选项 {/*options*/}
-- **`'none'`** (default, recommended): Skip components that can't be compiled and continue building
-- **`'critical_errors'`**: Fail the build only on critical compiler errors
-- **`'all_errors'`**: Fail the build on any compiler diagnostic
+- **`'none'`** (默认, 推荐): 跳过无法编译的组件并继续构建
+- **`'critical_errors'`**: 仅在关键编译器错误时使构建失败
+- **`'all_errors'`**: 遇到任何编译诊断即使构建失败
+
+#### 注意事项 {/*caveats*/}
-#### Caveats {/*caveats*/}
-
-- Production builds should always use `'none'`
-- Build failures prevent your application from building
-- The compiler automatically detects and skips problematic code with `'none'`
-- Higher thresholds are only useful during development for debugging
+- 生产环境构建应始终使用 `'none'`
+- 构建失败会阻止你的应用构建
+- 使用 `'none'` 时,编译器会自动检测并跳过有问题的代码
+- 更高的阈值仅在开发调试时有用
---
-## Usage {/*usage*/}
+## 用法 {/*usage*/}
-### Production configuration (recommended) {/*production-configuration*/}
+### 生产环境配置(推荐) {/*production-configuration*/}
-For production builds, always use `'none'`. This is the default value:
+对于生产构建,始终使用 `'none'`。这是默认值:
```js
{
@@ -61,15 +61,15 @@ For production builds, always use `'none'`. This is the default value:
}
```
-This ensures:
-- Your build never fails due to compiler issues
-- Components that can't be optimized run normally
-- Maximum components get optimized
-- Stable production deployments
+这样可以确保:
+- 构建不会因编译器问题而失败
+- 无法优化的组件仍可正常运行
+- 尽可能多的组件会被优化
+- 生产部署更加稳定
-### Development debugging {/*development-debugging*/}
+### 开发调试 {/*development-debugging*/}
-Temporarily use stricter thresholds to find issues:
+可临时使用更严格的阈值来定位问题:
```js
const isDevelopment = process.env.NODE_ENV === 'development';
@@ -84,4 +84,4 @@ const isDevelopment = process.env.NODE_ENV === 'development';
}
}
}
-```
\ No newline at end of file
+```
From f9880b43afddb220e2797f9aa0ee8717ebd809b9 Mon Sep 17 00:00:00 2001
From: Xleine
Date: Wed, 24 Sep 2025 10:18:58 +0800
Subject: [PATCH 2/2] Update
src/content/reference/react-compiler/panicThreshold.md
---
src/content/reference/react-compiler/panicThreshold.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/reference/react-compiler/panicThreshold.md b/src/content/reference/react-compiler/panicThreshold.md
index 6f8ea2b88a..dbdf59c502 100644
--- a/src/content/reference/react-compiler/panicThreshold.md
+++ b/src/content/reference/react-compiler/panicThreshold.md
@@ -4,7 +4,7 @@ title: panicThreshold
- `panicThreshold` 选项用于控制 React 编译器在编译过程中如何处理错误。
+`panicThreshold` 选项用于控制 React 编译器在编译过程中如何处理错误。