Skip to content

Commit 1f73446

Browse files
authored
Merge pull request #870 from kenji-arata/translate-react-compiler
Translate "React Compiler"-related articles
2 parents 60e2ac8 + 479b326 commit 1f73446

File tree

6 files changed

+240
-241
lines changed

6 files changed

+240
-241
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)