Skip to content

Commit 68ec2d1

Browse files
committed
translate React Compiler
1 parent 53ddad5 commit 68ec2d1

File tree

6 files changed

+237
-237
lines changed

6 files changed

+237
-237
lines changed
Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
---
2-
title: Debugging and Troubleshooting
2+
title: デバッグとトラブルシューティング
33
---
44

55
<Intro>
6-
This guide helps you identify and fix issues when using React Compiler. Learn how to debug compilation problems and resolve common issues.
6+
このガイドでは、React Compiler を使用する際の問題を特定し、修正する方法を説明します。コンパイル問題のデバッグ方法と一般的な問題の解決方法を学びましょう。
77
</Intro>
88

99
<YouWillLearn>
1010

11-
* The difference between compiler errors and runtime issues
12-
* Common patterns that break compilation
13-
* Step-by-step debugging workflow
11+
* コンパイラエラーとランタイムエラーの違い
12+
* コンパイルを失敗させる一般的なパターン
13+
* 段階的なデバッグワークフロー
1414

1515
</YouWillLearn>
1616

17-
## Understanding Compiler Behavior {/*understanding-compiler-behavior*/}
17+
## コンパイラの動作を理解する {/*understanding-compiler-behavior*/}
1818

19-
React Compiler is designed to handle code that follows the [Rules of React](/reference/rules). When it encounters code that might break these rules, it safely skips optimization rather than risk changing your app's behavior.
19+
React Compiler [React のルール](/reference/rules) に従うコードを処理するように設計されています。これらのルールに違反する可能性のあるコードに遭遇した場合、アプリケーションの動作を変更するリスクを冒すよりも、最適化を安全にスキップします。
2020

21-
### Compiler Errors vs Runtime Issues {/*compiler-errors-vs-runtime-issues*/}
21+
### コンパイラエラーとランタイムエラー {/*compiler-errors-vs-runtime-issues*/}
2222

23-
**Compiler errors** occur at build time and prevent your code from compiling. These are rare because the compiler is designed to skip problematic code rather than fail.
23+
**コンパイラエラー** はビルド時に発生し、コードのコンパイルを妨げます。コンパイラは問題のあるコードをスキップするように設計されているため、エラーが発生することは稀です。
2424

25-
**Runtime issues** occur when compiled code behaves differently than expected. Most of the time, if you encounter an issue with React Compiler, it's a runtime issue. This typically happens when your code violates the Rules of React in subtle ways that the compiler couldn't detect, and the compiler mistakenly compiled a component it should have skipped.
25+
**ランタイムエラー** は、コンパイルされたコードが期待とは異なる動作をする場合に発生します。React Compiler で問題に遭遇した場合、ほとんどの場合はランタイムエラーです。これは通常、コンパイラが検出できない微妙な方法で React のルールをコードが違反し、コンパイラがスキップすべきコンポーネントを誤ってコンパイルした場合に発生します。
2626

27-
When debugging runtime issues, focus your efforts on finding Rules of React violations in the affected components that were not detected by the ESLint rule. The compiler relies on your code following these rules, and when they're broken in ways it can't detect, that's when runtime problems occur.
27+
ランタイムエラーをデバッグする際は、影響を受けるコンポーネント内の ESLint ルールで検出できなかった React のルール違反を見つけることに集中してください。コンパイラはコードがこれらのルールに従うことを前提としており、検出できない方法でルールに違反した場合にランタイムエラーが発生します。
2828

2929

30-
## Common Breaking Patterns {/*common-breaking-patterns*/}
30+
## 一般的な破綻パターン {/*common-breaking-patterns*/}
3131

32-
One of the main ways React Compiler can break your app is if your code was written to rely on memoization for correctness. This means your app depends on specific values being memoized to work properly. Since the compiler may memoize differently than your manual approach, this can lead to unexpected behavior like effects over-firing, infinite loops, or missing updates.
32+
React Compiler がアプリケーションを失敗させる代表的な方法の 1 つは、挙動の正しさをメモ化に依存して記述することです。これは、アプリケーションが正常に動作するために、特定の値がメモ化されることに依存している状態です。コンパイラは、手動のアプローチとは異なる方法でメモ化を行う可能性があるため、副作用の過剰発火や無限ループ、更新の欠落といった予期せぬ動作を引き起こす可能性があります。
3333

34-
Common scenarios where this occurs:
34+
これが発生する一般的なシナリオ:
3535

36-
- **Effects that rely on referential equality** - When effects depend on objects or arrays maintaining the same reference across renders
37-
- **Dependency arrays that need stable references** - When unstable dependencies cause effects to fire too often or create infinite loops
38-
- **Conditional logic based on reference checks** - When code uses referential equality checks for caching or optimization
36+
- **参照の同一性に依存する副作用** - 副作用が、複数回のレンダーでもオブジェクトや配列が同じ参照を保つことを必要とする場合
37+
- **安定した参照を必要とする依存配列** - 依存が不安定だと、エフェクトが過剰に発火したり無限ループを引き起こす場合
38+
- **参照チェックに基づく条件ロジック** - キャッシュや最適化のために参照同一性のチェックを行っている場合
3939

40-
## Debugging Workflow {/*debugging-workflow*/}
40+
## デバッグワークフロー {/*debugging-workflow*/}
4141

42-
Follow these steps when you encounter issues:
42+
問題に遭遇した場合は、以下の手順に従ってください:
4343

44-
### Compiler Build Errors {/*compiler-build-errors*/}
44+
### コンパイラビルドエラー {/*compiler-build-errors*/}
4545

46-
If you encounter a compiler error that unexpectedly breaks your build, this is likely a bug in the compiler. Report it to the [facebook/react](https://github.com/facebook/react/issues) repository with:
47-
- The error message
48-
- The code that caused the error
49-
- Your React and compiler versions
46+
コンパイラエラーにより予期せずビルドが失敗した場合、これはコンパイラのバグである可能性が高いです。以下を含めて [facebook/react](https://github.com/facebook/react/issues) リポジトリに報告してください:
47+
- エラーメッセージ
48+
- エラーを引き起こしたコード
49+
- React とコンパイラのバージョン
5050

51-
### Runtime Issues {/*runtime-issues*/}
51+
### ランタイムエラー {/*runtime-issues*/}
5252

53-
For runtime behavior issues:
53+
ランタイム動作の問題については:
5454

55-
### 1. Temporarily Disable Compilation {/*temporarily-disable-compilation*/}
55+
### 1. コンパイルを一時的に無効化 {/*temporarily-disable-compilation*/}
5656

57-
Use `"use no memo"` to isolate whether an issue is compiler-related:
57+
問題がコンパイラに関係するかを切り分けるために `"use no memo"` を使用します:
5858

5959
```js
6060
function ProblematicComponent() {
@@ -63,31 +63,31 @@ function ProblematicComponent() {
6363
}
6464
```
6565

66-
If the issue disappears, it's likely related to a Rules of React violation.
66+
これにより問題が解決した場合、React のルール違反に関連している可能性が高いです。
6767

68-
You can also try removing manual memoization (useMemo, useCallback, memo) from the problematic component to verify that your app works correctly without any memoization. If the bug still occurs when all memoization is removed, you have a Rules of React violation that needs to be fixed.
68+
問題のあるコンポーネントから手動のメモ化(useMemouseCallbackmemo)を削除し、メモ化なしでアプリケーションが正しく動作することを確認することもできます。すべてのメモ化を削除してもバグが発生する場合は、修正が必要な React のルール違反があります。
6969

70-
### 2. Fix Issues Step by Step {/*fix-issues-step-by-step*/}
70+
### 2. 段階的な問題の修正 {/*fix-issues-step-by-step*/}
7171

72-
1. Identify the root cause (often memoization-for-correctness)
73-
2. Test after each fix
74-
3. Remove `"use no memo"` once fixed
75-
4. Verify the component shows the ✨ badge in React DevTools
72+
1. 根本原因を特定する(典型例は、挙動の正しさがメモ化に依存した実装)
73+
2. 各修正後にテストする
74+
3. 修正したら `"use no memo"` を削除する
75+
4. コンポーネントが React DevTools で ✨ バッジを表示することを確認する
7676

77-
## Reporting Compiler Bugs {/*reporting-compiler-bugs*/}
77+
## コンパイラバグの報告 {/*reporting-compiler-bugs*/}
7878

79-
If you believe you've found a compiler bug:
79+
コンパイラバグを発見したと思われる場合:
8080

81-
1. **Verify it's not a Rules of React violation** - Check with ESLint
82-
2. **Create a minimal reproduction** - Isolate the issue in a small example
83-
3. **Test without the compiler** - Confirm the issue only occurs with compilation
84-
4. **File an [issue](https://github.com/facebook/react/issues/new?template=compiler_bug_report.yml)**:
85-
- React and compiler versions
86-
- Minimal reproduction code
87-
- Expected vs actual behavior
88-
- Any error messages
81+
1. **React のルール違反ではないことを確認する** - ESLint でチェック
82+
2. **最小限の再現方法を特定する** - 小さな例で問題を切り分ける
83+
3. **コンパイラなしでテストする** - 問題がコンパイル時のみに発生することを確認
84+
4. **[issue](https://github.com/facebook/react/issues/new?template=compiler_bug_report.yml) を提出する**
85+
- React とコンパイラのバージョン
86+
- 最小限の再現コード
87+
- 期待される動作と実際の動作
88+
- エラーメッセージ
8989

90-
## Next Steps {/*next-steps*/}
90+
## 次のステップ {/*next-steps*/}
9191

92-
- Review the [Rules of React](/reference/rules) to prevent issues
93-
- Check the [incremental adoption guide](/learn/react-compiler/incremental-adoption) for gradual rollout strategies
92+
- 問題を防ぐために [React のルール](/reference/rules) を確認
93+
- 段階的な展開戦略については [段階的導入ガイド](/learn/react-compiler/incremental-adoption) を確認

0 commit comments

Comments
 (0)