Skip to content

Commit 8a0810d

Browse files
authored
Merge pull request #951 from nihar-ux18/translate-cacheSignal
docs(ja): translate cacheSignal page
2 parents 7f38231 + 78939fb commit 8a0810d

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

src/content/reference/react/cacheSignal.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ title: cacheSignal
44

55
<RSC>
66

7-
`cacheSignal` is currently only used with [React Server Components](/blog/2023/03/22/react-labs-what-we-have-been-working-on-march-2023#react-server-components).
7+
`cacheSignal` は現在、[React Server Components](/blog/2023/03/22/react-labs-what-we-have-been-working-on-march-2023#react-server-components) でのみ使用できます。
88

99
</RSC>
1010

1111
<Intro>
1212

13-
`cacheSignal` allows you to know when the `cache()` lifetime is over.
13+
`cacheSignal` を使用すると、`cache()` のライフタイムが終了したタイミングを知ることができます。
1414

1515
```js
1616
const signal = cacheSignal();
@@ -22,11 +22,11 @@ const signal = cacheSignal();
2222

2323
---
2424

25-
## Reference {/*reference*/}
25+
## リファレンス {/*reference*/}
2626

2727
### `cacheSignal` {/*cachesignal*/}
2828

29-
Call `cacheSignal` to get an `AbortSignal`.
29+
`cacheSignal` を呼び出すことで `AbortSignal` を取得できます。
3030

3131
```js {3,7}
3232
import {cacheSignal} from 'react';
@@ -35,32 +35,32 @@ async function Component() {
3535
}
3636
```
3737

38-
When React has finished rendering, the `AbortSignal` will be aborted. This allows you to cancel any in-flight work that is no longer needed.
39-
Rendering is considered finished when:
40-
- React has successfully completed rendering
41-
- the render was aborted
42-
- the render has failed
38+
React がレンダーを完了すると、`AbortSignal` は中断されます。これにより、不要になった進行中の処理をキャンセルできます。
39+
レンダーは、次のいずれかの場合に完了したとみなされます。
40+
- React が正常にレンダーを完了した場合
41+
- レンダーが中断された場合
42+
- レンダーが失敗した場合
4343

44-
#### Parameters {/*parameters*/}
44+
#### 引数 {/*parameters*/}
4545

46-
This function does not accept any parameters.
46+
この関数は引数を受け取りません。
4747

48-
#### Returns {/*returns*/}
48+
#### 返り値 {/*returns*/}
4949

50-
`cacheSignal` returns an `AbortSignal` if called during rendering. Otherwise `cacheSignal()` returns `null`.
50+
`cacheSignal` は、レンダー中に呼び出された場合、`AbortSignal` を返します。それ以外の場合、`cacheSignal()` `null` を返します。
5151

52-
#### Caveats {/*caveats*/}
52+
#### 注意点 {/*caveats*/}
5353

54-
- `cacheSignal` is currently for use in [React Server Components](/reference/rsc/server-components) only. In Client Components, it will always return `null`. In the future it will also be used for Client Component when a client cache refreshes or invalidates. You should not assume it'll always be null on the client.
55-
- If called outside of rendering, `cacheSignal` will return `null` to make it clear that the current scope isn't cached forever.
54+
- `cacheSignal` は現在、[React Server Components](/reference/rsc/server-components) でのみ使用できます。クライアントコンポーネントでは常に `null` を返します。将来的には、クライアントキャッシュの更新や無効化が行われる際にクライアントコンポーネントでも使用される予定です。クライアントでは常に `null` になるとは想定しないでください。
55+
- レンダーの外で呼び出された場合、`cacheSignal` `null` を返します。これは、現在のスコープが永続的にキャッシュされるものではないことを明確にするためです。
5656

5757
---
5858

59-
## Usage {/*usage*/}
59+
## 使用法 {/*usage*/}
6060

61-
### Cancel in-flight requests {/*cancel-in-flight-requests*/}
61+
### 進行中のリクエストをキャンセルする {/*cancel-in-flight-requests*/}
6262

63-
Call <CodeStep step={1}>`cacheSignal`</CodeStep> to abort in-flight requests.
63+
進行中のリクエストを中断するには、<CodeStep step={1}>`cacheSignal`</CodeStep> を呼び出します。
6464

6565
```js [[1, 4, "cacheSignal()"]]
6666
import {cache, cacheSignal} from 'react';
@@ -71,7 +71,7 @@ async function Component() {
7171
```
7272

7373
<Pitfall>
74-
You can't use `cacheSignal` to abort async work that was started outside of rendering e.g.
74+
レンダーの外で開始された非同期処理は `cacheSignal` を使用して中断できません。例えば、次のようなコードです。
7575

7676
```js
7777
import {cacheSignal} from 'react';
@@ -83,9 +83,9 @@ async function Component() {
8383
```
8484
</Pitfall>
8585

86-
### Ignore errors after React has finished rendering {/*ignore-errors-after-react-has-finished-rendering*/}
86+
### React がレンダーを完了した後のエラーを無視する {/*ignore-errors-after-react-has-finished-rendering*/}
8787

88-
If a function throws, it may be due to cancellation (e.g. <CodeStep step={1}>the Database connection</CodeStep> has been closed). You can use the <CodeStep step={2}>`aborted` property</CodeStep> to check if the error was due to cancellation or a real error. You may want to <CodeStep step={3}>ignore errors</CodeStep> that were due to cancellation.
88+
関数が例外をスローした場合、その原因がキャンセルであることがあります(例えば、<CodeStep step={1}>データベース接続</CodeStep> が閉じられた場合など)。<CodeStep step={2}>`aborted` プロパティ</CodeStep> を使用すると、そのエラーがキャンセルによるものか、本当のエラーなのかを確認できます。キャンセルが原因のエラーを、<CodeStep step={3}>無視</CodeStep> すべき場合があります。
8989

9090
```js [[1, 2, "./database"], [2, 8, "cacheSignal()?.aborted"], [3, 12, "return null"]]
9191
import {cacheSignal} from "react";

0 commit comments

Comments
 (0)