Skip to content

Commit e2d7358

Browse files
Update documentation links for React Compiler and hooks, improve error handling in forms, and enhance static path generation logic
1 parent 55a7437 commit e2d7358

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

src/content/blog/2024/10/21/react-compiler-beta-release.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ Or, if you're using Yarn:
6464
yarn add -D eslint-plugin-react-compiler@beta
6565
</TerminalBlock>
6666

67-
After installation you can enable the linter by [adding it to your ESLint config](/learn/react-compiler#installing-eslint-plugin-react-compiler). Using the linter helps identify Rules of React breakages, making it easier to adopt the compiler when it's fully released.
67+
After installation you can enable the linter by [adding it to your ESLint config](/learn/react-compiler/installation#eslint-integration). Using the linter helps identify Rules of React breakages, making it easier to adopt the compiler when it's fully released.
6868

6969
## Backwards Compatibility {/*backwards-compatibility*/}
7070

71-
React Compiler produces code that depends on runtime APIs added in React 19, but we've since added support for the compiler to also work with React 17 and 18. If you are not on React 19 yet, in the Beta release you can now try out React Compiler by specifying a minimum `target` in your compiler config, and adding `react-compiler-runtime` as a dependency. [You can find docs on this here](/learn/react-compiler#using-react-compiler-with-react-17-or-18).
71+
React Compiler produces code that depends on runtime APIs added in React 19, but we've since added support for the compiler to also work with React 17 and 18. If you are not on React 19 yet, in the Beta release you can now try out React Compiler by specifying a minimum `target` in your compiler config, and adding `react-compiler-runtime` as a dependency. [You can find docs on this here](/reference/react-compiler/target#targeting-react-17-or-18).
7272

7373
## Using React Compiler in libraries {/*using-react-compiler-in-libraries*/}
7474

@@ -78,7 +78,7 @@ React Compiler can also be used to compile libraries. Because React Compiler nee
7878

7979
Because your code is pre-compiled, users of your library will not need to have the compiler enabled in order to benefit from the automatic memoization applied to your library. If your library targets apps not yet on React 19, specify a minimum `target` and add `react-compiler-runtime` as a direct dependency. The runtime package will use the correct implementation of APIs depending on the application's version, and polyfill the missing APIs if necessary.
8080

81-
[You can find more docs on this here.](/learn/react-compiler#using-the-compiler-on-libraries)
81+
[You can find more docs on this here.](/reference/react-compiler/target#using-the-compiler-on-libraries)
8282

8383
## Opening up React Compiler Working Group to everyone {/*opening-up-react-compiler-working-group-to-everyone*/}
8484

src/content/reference/react-dom/components/form.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ export async function deliverMessage(message) {
274274
</Sandpack>
275275

276276
[//]: # 'Uncomment the next line, and delete this line after the `useOptimistic` reference documentatino page is published'
277-
[//]: # 'To learn more about the `useOptimistic` Hook see the [reference documentation](/reference/react/hooks/useOptimistic).'
277+
[//]: # 'To learn more about the `useOptimistic` Hook see the [reference documentation](/reference/react/useOptimistic).'
278278

279279
### Handling form submission errors {/*handling-form-submission-errors*/}
280280

src/content/reference/react-dom/createPortal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ A portal only changes the physical placement of the DOM node. In every other way
5050
5151
* `domNode`: Some DOM node, such as those returned by `document.getElementById()`. The node must already exist. Passing a different DOM node during an update will cause the portal content to be recreated.
5252
53-
* **optional** `key`: A unique string or number to be used as the portal's [key.](/learn/rendering-lists/#keeping-list-items-in-order-with-key)
53+
* **optional** `key`: A unique string or number to be used as the portal's [key.](/learn/rendering-lists#keeping-list-items-in-order-with-key)
5454
5555
#### Returns {/*returns*/}
5656

src/content/reference/rsc/use-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async function addToCart(data) {
4545
* عند استيراد Server Action من [كود Client](/reference/rsc/use-client)، يجب استخدام التوجيهات على مستوى الملف وليس الدالة.
4646
* لأن الاستدعاءات الشبكية الأساسية دائمًا غير متزامنة، يمكن استخدام `'use server'` فقط في دوال غير متزامنة (async).
4747
* تذكر أن المعاملات الممررة إلى دالة مميزة بـ `'use server'` متحكم بها بالكامل من جانب العميل. للأمان، عاملها دائمًا كإدخال غير موثوق به، وتأكد من التحقق من صحتها وتصفيتها كما يناسبك.
48-
* يفضل استعمال Server Actions في [`useTranistion`](/reference/rsc/useTransition)، أما Server Actions التي يتم تمريرها إلى [`<form action>`](/reference/react-dom/components/form#props) أو [`formAction`](/reference/react-dom/components/input#props) سيتم إضافة transition لهم تلقائيًا.
48+
* يفضل استعمال Server Actions في [`useTransition`](/reference/react/useTransition)، أما Server Actions التي يتم تمريرها إلى [`<form action>`](/reference/react-dom/components/form#props) أو [`formAction`](/reference/react-dom/components/input#props) سيتم إضافة transition لهم تلقائيًا.
4949
* تم تصميم Server Actions لعمليات تعديل حالة الخادم. لا ينصح باستخدامهم في جلب البيانات، ووفقًا لذلك، فإن الإطارات التي تنفذ Server Actions عادة تعالج إجراء واحد في كل مرة وليس لديها طريقة لتخزين قيمة الإرجاع.
5050

5151
### الاعتبارات الأمنية {/*security*/}

src/pages/[[...markdownPath]].js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,20 @@ export async function getStaticPaths() {
170170

171171
const files = await getFiles(rootDir);
172172

173-
const paths = files.map((file) => ({
174-
params: {
175-
markdownPath: getSegments(file),
176-
// ^^^ CAREFUL HERE.
177-
// If you rename markdownPath, update patches/next-remote-watch.patch too.
178-
// Otherwise you'll break Fast Refresh for all MD files.
179-
},
180-
}));
173+
const paths = files
174+
.filter((file) => {
175+
// Additional safety check: exclude errors directory
176+
const normalizedPath = file.replace(/\\/g, '/');
177+
return !normalizedPath.startsWith('errors/');
178+
})
179+
.map((file) => ({
180+
params: {
181+
markdownPath: getSegments(file),
182+
// ^^^ CAREFUL HERE.
183+
// If you rename markdownPath, update patches/next-remote-watch.patch too.
184+
// Otherwise you'll break Fast Refresh for all MD files.
185+
},
186+
}));
181187

182188
return {
183189
paths: paths,

0 commit comments

Comments
 (0)