Skip to content

Commit 1969820

Browse files
committed
tranlate react compiler section
1 parent 4f818eb commit 1969820

File tree

5 files changed

+252
-257
lines changed

5 files changed

+252
-257
lines changed
Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,93 @@
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 بطرق دقيقة لا يستطيع الـ ESLint اكتشافها، فيقوم المُجمِّع بتجميع مكوّن كان ينبغي عليه تجاهله.
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+
عند تتبُّع مشكلات وقت التشغيل، ركز على البحث عن انتهاكات قواعد React في المكونات المتأثرة والتي لم يكشفها ESLint. يعتمد المُجمِّع على التزام الشيفرة بهذه القواعد، وعندما تُخالف بطرق لا يستطيع اكتشافها، تظهر مشكلات وقت التشغيل.
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 هو اعتماد الشيفرة على التذكُّر (memoization) كجزء من صحة البرنامج. يعني هذا أن التطبيق يعتمد على قيم محفوظة في الذاكرة لتعمل بشكل صحيح. ولأن المُجمِّع قد يقوم بعمليات تذكُّر مختلفة عن نهجك اليدوي، فقد يؤدي ذلك لسلوك غير متوقع مثل تكرار تنفيذ التأثيرات (effects) بشكل زائد، الحلقات غير المنتهية، أو فقدان التحديثات.
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() {
61-
"use no memo"; // Skip compilation for this component
62-
// ... rest of component
61+
"use no memo"; // تخطي التجميع لهذا المكوّن
62+
// ... بقية المكوّن
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+
يمكنك أيضًا محاولة إزالة التذكُّر اليدوي (useMemo, useCallback, memo) من المكوّن المتسبب للتحقق مما إذا كان التطبيق يعمل بشكل صحيح بدون أي تذكُّر. إذا بقي الخطأ بعد إزالة كل التذكُّرات، فذلك يدل على وجود انتهاك لقواعد 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. حدّد السبب الجذري (غالبًا ما يكون الاعتماد على التذكُّر من أجل الصحة correctness)
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)