Skip to content

Commit

Permalink
Merge pull request #277 from Gehbt/fix-link
Browse files Browse the repository at this point in the history
docs(api): Fix md-links and bad brackets
  • Loading branch information
edemaine committed Oct 22, 2023
2 parents 40c8ec2 + dde6c2a commit 9edb13b
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 41 deletions.
16 changes: 9 additions & 7 deletions langs/en/api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ It will be called again whenever the value of `sourceSignal` changes, and that v
You can call `mutate` to directly update the `data` signal (it works like any other signal setter). You can also call `refetch` to rerun the fetcher directly, and pass an optional argument to provide additional info to the fetcher: `refetch(info)`.
`data` works like a normal signal getter: use `data()` to read the last returned value of `fetchData`.
But it also has extra reactive properties: `data.loading` tells you if the fetcher has been called but not returned, and `data.error` tells you if the request has errored out; if so, it contains the error thrown by the fetcher. (Note: if you anticipate errors, you may want to wrap `createResource` in an [ErrorBoundary](#<errorboundary>).)
But it also has extra reactive properties: `data.loading` tells you if the fetcher has been called but not returned, and `data.error` tells you if the request has errored out; if so, it contains the error thrown by the fetcher. (Note: if you anticipate errors, you may want to wrap `createResource` in an [ErrorBoundary](#errorboundary).)
As of **1.4.0**, `data.latest` will return the last returned value and won't trigger [Suspense](#<suspense>) and [transitions](#usetransition); if no value has been returned yet, `data.latest` acts the same as `data()`. This can be useful if you want to show the out-of-date data while the new data is loading.
As of **1.4.0**, `data.latest` will return the last returned value and won't trigger [Suspense](#suspense) and [transitions](#usetransition); if no value has been returned yet, `data.latest` acts the same as `data()`. This can be useful if you want to show the out-of-date data while the new data is loading.
`loading`, `error`, and `latest` are reactive getters and can be tracked.
Expand Down Expand Up @@ -572,9 +572,10 @@ createEffect(on(a, (v) => console.log(v), { defer: true }));
setA("new"); // now it runs
```
Please note that on `stores` and `mutable`, adding or removing a property from the parent object will trigger an effect. See [`createMutable`](#createMutable)
Please note that on `stores` and `mutable`, adding or removing a property from the parent object will trigger an effect. See [`createMutable`](#createmutable)
## `catchError`
**New in v1.7.0**
```ts
Expand All @@ -586,6 +587,7 @@ function catchError<T>(tryFn: () => T, onError: (err: any) => void): T;
Wraps a `tryFn` with an error handler that fires if an error occurs below that point. Only the nearest scope error handlers execute. Rethrow to trigger up the line.

## `onError`

**Deprecated for catchError in v1.7**

```ts
Expand Down Expand Up @@ -1314,13 +1316,13 @@ provides two alternate ways to do similar things:
modifyMutable(state.user, reconcile({
firstName: "Jake",
lastName: "Johnson",
});
}));

// Modify two fields in batch, triggering just one update
modifyMutable(state.user, produce((u) => {
u.firstName = "Jake";
u.lastName = "Johnson";
});
}));
```
# Component APIs
Expand Down Expand Up @@ -1629,8 +1631,8 @@ Before using it, consider the closely related primitives
[`createMemo`](#creatememo) and [`createRenderEffect`](#createrendereffect).

Like `createMemo`, `createComputed` calls its function immediately on updates
(unless you're in a [batch](#batch), [effect](#createEffect), or
[transition](#use-transition)).
(unless you're in a [batch](#batch), [effect](#createeffect), or
[transition](#usetransition)).
However, while `createMemo` functions should be pure (not set any signals),
`createComputed` functions can set signals.
Related, `createMemo` offers a readonly signal for the return value of the
Expand Down
2 changes: 1 addition & 1 deletion langs/es/api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ En el segundo, se llamará a `fetchData` tan pronto como `sourceSignal` tenga cu
De cualquier manera, puede llamar a `mutate` para actualizar directamente la signal `data` (funciona como cualquier otro emisor de signals). También puede llamar a `refetch` para volver a ejecutar el buscador directamente y pasar un argumento opcional para proporcionar información adicional al buscador: `refetch(info)`.

`data` funciona como un receptor de señal normal: usa `data()` para leer el último valor devuelto de `fetchData`.
Pero también tiene dos propiedades extra: `data.loading` te dice si el buscador ha sido llamado pero no devuelto, y `data.error` te dice si la solicitud ha fallado; si es así, contiene el error arrojado por el buscador. (Nota: si prevé errores, es posible que desee incluir `createResource` en un [ErrorBoundary](#<errorboundary>).)
Pero también tiene dos propiedades extra: `data.loading` te dice si el buscador ha sido llamado pero no devuelto, y `data.error` te dice si la solicitud ha fallado; si es así, contiene el error arrojado por el buscador. (Nota: si prevé errores, es posible que desee incluir `createResource` en un [ErrorBoundary](#errorboundary).)

`loading` y `error` son getters reactivos y pueden recibir seguimiento.

Expand Down
2 changes: 1 addition & 1 deletion langs/fr/api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ onCleanup(() => unsubscribe());
export function createMutable<T extends StoreNode>(
state: T | Store<T>,
options?: { name?: string }
): Store<T> {
): Store<T>;
```

Créer un nouvel objet Store mutable. Les stores se mettent à jour seulement quand les valeurs changent. Le traçage est fait par l'interception de l'accès de propriété et automatiquement tracé dans des imbrications profondes en utilisant un proxy.
Expand Down
22 changes: 11 additions & 11 deletions langs/ja/api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Solid の JSX コンパイラーは、ほとんどの JSX 式(中括弧内の


その結果、通常は依存関係のことを気にする必要はありません。
(しかし、自動的な依存関係追跡が目的の結果をもたらさない場合は、[依存関係追跡をオーバーライド](#reactive-utilities)できます)
(しかし、自動的な依存関係追跡が目的の結果をもたらさない場合は、[依存関係追跡をオーバーライド](#リアクティブのユーティリティ)できます)

このアプローチにより、リアクティビティがコンポーザブルになります。ある関数を別の関数内で呼び出すと、一般に呼び出した関数は呼び出された関数の依存関係を継承することになります。

Expand Down Expand Up @@ -95,7 +95,7 @@ const newCount = setCount((prev) => prev + 1);
> const [func, setFunc] = createSignal(myFunction);
> ```
[バッチ](#batch)[Effect](#createEffect)[トランジション](#use-transition)の中でなければ、Signal は設定するとすぐに更新されます。
[バッチ](#batch)[Effect](#createeffect)[トランジション](#usetransition)の中でなければ、Signal は設定するとすぐに更新されます。

例えば:

Expand Down Expand Up @@ -214,7 +214,7 @@ Effect 関数の最初の実行は即時ではありません。現在のレン



この最初の実行の後、通常、Effect は依存関係が更新されるとすぐに実行されます([batch](#batch)[transition](#use-transition) をしている場合を除く)。例えば:
この最初の実行の後、通常、Effect は依存関係が更新されるとすぐに実行されます([batch](#batch)[transition](#usetransition) をしている場合を除く)。例えば:



Expand Down Expand Up @@ -415,9 +415,9 @@ const [data, { mutate, refetch }] = createResource(sourceSignal, fetchData);
`mutate` を呼び出すことで、`data` Signal を直接更新できます(他の Signal セッターと同じように動作します)。また、`refetch` を呼び出すことでフェッチャーを直接再実行でき、`refetch(info)` のように追加の引数を渡すことで、フェッチャーに追加情報を提供できます。
`data` は通常の Signal のゲッターのように動作します。 `fetchData` の最後の戻り値を読み取るには `data()` を使用します。
しかし、これには追加のリアクティブなプロパティがあり、`data.loading` はフェッチャーが呼び出されたが返されていないかどうかを示します。そして、`data.error` はリクエストがエラーになったかどうかを示します(注意: もしエラーが予想される場合は `createResource` を [ErrorBoundary](#<errorboundary>)でラップするとよいでしょう)。
しかし、これには追加のリアクティブなプロパティがあり、`data.loading` はフェッチャーが呼び出されたが返されていないかどうかを示します。そして、`data.error` はリクエストがエラーになったかどうかを示します(注意: もしエラーが予想される場合は `createResource` を [ErrorBoundary](#errorboundary)でラップするとよいでしょう)。
**1.4.0** では、`data.latest` は最後に返された値を返し、[Suspension](#<suspense>) や [transitions](#usetransition) をトリガーしません。まだ値が返されていない場合は `data()` と同じ動作をします。これは、新しいデータを読み込んでいる間、古くなったデータを表示させたい場合に便利です。
**1.4.0** では、`data.latest` は最後に返された値を返し、[Suspension](#suspense) や [transitions](#usetransition) をトリガーしません。まだ値が返されていない場合は `data()` と同じ動作をします。これは、新しいデータを読み込んでいる間、古くなったデータを表示させたい場合に便利です。
`loading``error``latest` はリアクティブゲッターで、追跡が可能です。
Expand Down Expand Up @@ -556,7 +556,7 @@ createEffect(on(a, (v) => console.log(v), { defer: true }));
setA("new"); // ここで実行される
```
なお、 `stores``mutable` では、親オブジェクトのプロパティを追加したり削除したりすると、Effect が発生することに注意してください。[`createMutable`](#createMutable) を参照してください。
なお、 `stores``mutable` では、親オブジェクトのプロパティを追加したり削除したりすると、Effect が発生することに注意してください。[`createMutable`](#createmutable) を参照してください。
## `createRoot`
Expand All @@ -581,7 +581,7 @@ function getOwner(): Owner;
現在実行中のコードを所有するリアクティブスコープを取得します。例えば、現在のスコープ外で後から `runWithOwner` を呼び出す際に渡します。


内部的には、計算 (Effect、Memo など)は自分のオーナーの子であるオーナーを作成し、`createRoot` や `render` で作成したルートオーナーまでさかのぼります。特に、このオーナーシップツリーによって、Solid はそのサブツリーをトラバースして、すべての [`onCleanup`](#oncleanup) コールバックを呼び出すことによって、破棄された計算を自動的にクリーンアップできます。
内部的には、計算 Effect、Memo など)は自分のオーナーの子であるオーナーを作成し、`createRoot` や `render` で作成したルートオーナーまでさかのぼります。特に、このオーナーシップツリーによって、Solid はそのサブツリーをトラバースして、すべての [`onCleanup`](#oncleanup) コールバックを呼び出すことによって、破棄された計算を自動的にクリーンアップできます。



Expand Down Expand Up @@ -1252,13 +1252,13 @@ batch(() => {
modifyMutable(state.user, reconcile({
firstName: "Jake",
lastName: "Johnson",
});
}));

// 2 つのフィールドを一括で変更し、1回だけ更新をトリガーする
modifyMutable(state.user, produce((u) => {
u.firstName = "Jake";
u.lastName = "Johnson";
});
}));
```
# コンポーネント API
Expand Down Expand Up @@ -1406,7 +1406,7 @@ const Wrapper = (props) => {
`children` ヘルパーの重要な点は、 `props.children` にすぐにアクセスして、強制的に子を作成し解決することです。
これは、例えば、[`<Show>`](#<show>) コンポーネント内で子を使用する場合など、条件付きレンダリングには望ましくない場合があります。
これは、例えば、[`<Show>`](#show) コンポーネント内で子を使用する場合など、条件付きレンダリングには望ましくない場合があります。
たとえば、次のコードは常に子を評価します:
Expand Down Expand Up @@ -1568,7 +1568,7 @@ function createComputed<T>(fn: (v: T) => T, value?: T): void;
使用する前に、密接に関連するプリミティブである [`createMemo`](#creatememo) と [`createRenderEffect`](#createrendereffect) を検討してみてください。


`createMemo` と同様に、 `createComputed` は更新があるとすぐにその関数を呼び出します(ただし、[batch](#batch)、[effect](#createEffect)、または [transition](#use-transition) を使用している場合は除く)。
`createMemo` と同様に、 `createComputed` は更新があるとすぐにその関数を呼び出します(ただし、[batch](#batch)、[effect](#createeffect)、または [transition](#usetransition) を使用している場合は除く)。


ただし、`createMemo` 関数は純粋であるべき(シグナルを更新してはいけません)である一方、 `createComputed` 関数はシグナルを更新できます。
Expand Down
22 changes: 11 additions & 11 deletions langs/ko-kr/api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const newCount = setCount((prev) => prev + 1);
> const [func, setFunc] = createSignal(myFunction);
> ```
[batch](#batch), [effect](#createEffect), [transition](#use-transition)에 있는 것이 아니라면, 시그널은 설정하는 즉시 업데이트됩니다.
[batch](#batch), [effect](#createeffect), [transition](#usetransition)에 있는 것이 아니라면, 시그널은 설정하는 즉시 업데이트됩니다.
예를 들어:

```js
Expand Down Expand Up @@ -162,7 +162,7 @@ createEffect((prev) => {

이펙트 함수의 _첫 번째_ 실행은 바로 실행되지 않으며, 현재 렌더링 단계 이후에 실행되도록 예약됩니다(예: [`render`](#render), [`createRoot`](#createroot), [`runWithOwner`](#runwithowner) 에 전달된 함수를 호출한 후).
첫 번째 실행시까지 대기하려면, 브라우저가 DOM을 렌더링하기 전에 실행되는 [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask) 를 사용하거나, 브라우저 렌더링 후에 실행되는 `await Promise.resolve()` 혹은 `setTimeout(..., 0)` 을 사용하세요.
첫 번째 실행 후, 이펙트는 일반적으로 디펜던시가 업데이트될 때 즉시 실행됩니다([batch](#batch) 혹은 [transition](#use-transition)인 경우는 예외입니다).
첫 번째 실행 후, 이펙트는 일반적으로 디펜던시가 업데이트될 때 즉시 실행됩니다([batch](#batch) 혹은 [transition](#usetransition)인 경우는 예외입니다).
예를 들어:

```js
Expand Down Expand Up @@ -327,13 +327,13 @@ const [data, { mutate, refetch }] = createResource(sourceSignal, fetchData);
두 번째 경우, `sourceSignal``false`, `null`, `undefined` 이외의 값을 갖는 즉시 `fetchData`가 호출됩니다.
`sourceSignal` 값이 변경될 때마다 다시 호출되며, 그 값은 항상 `fetchData` 함수의 첫 번째 인수로 전달됩니다.
`mutate`를 호출해 `data` 시그널을 직접 업데이트((다른 시그널 setter 처럼 동작)할 수 있습니다.
`mutate`를 호출해 `data` 시그널을 직접 업데이트(다른 시그널 setter 처럼 동작)할 수 있습니다.
`refetch`를 호출해 fetcher를 직접 다시 실행하고, `refetch(info)`와 같이 옵셔널 인수를 전달하여 fetcher에 추가 정보를 제공할 수 있습니다: .
`data`는 일반 시그널 getter처럼 작동합니다: `data()`를 사용해 `fetchData`의 마지막 반환 값을 읽습니다.
하지만 두 가지 추가 리액티브 속성이 있습니다: `data.loading`은 fetcher가 호출되었지만 아직 반환되지 않았는지를 알려주며, `data.error`는 요청에 에러가 발생했는지 알려줍니다; 에러에는 fetcher에서 발생한 오류도 포합됩니다. (참고: 에러가 예상된다면, [ErrorBoundary](#<errorboundary>)에 `createResource`를 래핑할 수 있습니다.)
하지만 두 가지 추가 리액티브 속성이 있습니다: `data.loading`은 fetcher가 호출되었지만 아직 반환되지 않았는지를 알려주며, `data.error`는 요청에 에러가 발생했는지 알려줍니다; 에러에는 fetcher에서 발생한 오류도 포합됩니다. (참고: 에러가 예상된다면, [ErrorBoundary](#errorboundary)에 `createResource`를 래핑할 수 있습니다.)
**1.4.0** 버전에서는, `data.latest`는 마지막으로 반환된 값을 반환하며, [Suspense](#<suspense>)와 [트랜지션](#usetransition)을 트리거하지 않습니다; 아직 값이 반환된 적이 없다면, `data.latest``data()`와 동일하게 작동합니다. 이는 새 데이터를 로딩하는 도중에는 이전 데이터를 보여주고자 하는 경우 유용합니다.
**1.4.0** 버전에서는, `data.latest`는 마지막으로 반환된 값을 반환하며, [Suspense](#suspense)와 [트랜지션](#usetransition)을 트리거하지 않습니다; 아직 값이 반환된 적이 없다면, `data.latest``data()`와 동일하게 작동합니다. 이는 새 데이터를 로딩하는 도중에는 이전 데이터를 보여주고자 하는 경우 유용합니다.
`loading`, `error`, `latest`는 리액티브 getter이며 추적 가능합니다.
Expand Down Expand Up @@ -479,7 +479,7 @@ setA("new"); // 여기서 실행됩니다.
```
`stores``mutable`에서 부모 객체에서 속성을 추가하거나 삭제하면 이펙트가 트리거됩니다.
[`createMutable`](#createMutable) 참조.
[`createMutable`](#createmutable) 참조.
## `createRoot`
Expand Down Expand Up @@ -1159,13 +1159,13 @@ batch(() => {
modifyMutable(state.user, reconcile({
firstName: "Jake",
lastName: "Johnson",
});
}));

// batch에서 두 필드를 수정하며, 한 번의 업데이트만 트리거
modifyMutable(state.user, produce((u) => {
u.firstName = "Jake";
u.lastName = "Johnson";
});
}));
```
# Component APIs
Expand Down Expand Up @@ -1292,8 +1292,8 @@ const Wrapper = (props) => {
};
```
`children` 헬퍼의 중요한 측면은 `props.children`에 바로 액세스하므로 자식을 강제로 생성하고 결정해야 한다는 것입니다.
이는 [`<Show>`](#<show>) 컴포넌트 내에서 자식을 사용하는 것과 같은 조건부 렌더링시에는 바람직하지 않을 수 있습니다.
`children` 헬퍼의 중요한 측면은 `props.children`에 바로 액세스하므로 자식을 강제로 생성하고 결정해야 한다는 것입니다.
이는 [`<Show>`](#show) 컴포넌트 내에서 자식을 사용하는 것과 같은 조건부 렌더링시에는 바람직하지 않을 수 있습니다.
예를 들어, 다음 코드는 항상 자식을 평가합니다:
```tsx
Expand Down Expand Up @@ -1434,7 +1434,7 @@ function createComputed<T>(fn: (v: T) => T, value?: T): void;
하지만, `createComputed`는 다른 리액티브 프리미티브보다 더 많은 불필요한 업데이트를 쉽게 일으킬 수 있기 때문에 주의해서 사용해야 합니다.
사용 전에, 밀접하게 관련되어 있는 [`createMemo`](#creatememo)와 [`createRenderEffect`](#createrendereffect)을 고려해보세요.

`createMemo`와 마찬가지로, `createComputed`는 업데이트시 ([batch](#batch), [이펙트](#createEffect), [트랜지션](#use-transition)이 아닌 경우) 즉시 함수를 호출합니다.
`createMemo`와 마찬가지로, `createComputed`는 업데이트시 ([batch](#batch), [이펙트](#createeffect), [트랜지션](#usetransition)이 아닌 경우) 즉시 함수를 호출합니다.
하지만 `createMemo` 함수는 순수(어떤 시그널도 설정하지 않아야 함)해야 하지만, `createComputed` 함수는 시그널을 설정할 수 있습니다.
이와 관련해, `createMemo`는 함수 반환 값에 대해 읽기 전용 시그널을 제공하는 반면, `createComputed`로 동일한 작업을 수행하려면 함수 내에서 시그널을 설정해야 합니다.

Expand Down

0 comments on commit 9edb13b

Please sign in to comment.