Skip to content

Commit

Permalink
docs: add mutate filter functions documentation in v2
Browse files Browse the repository at this point in the history
  • Loading branch information
koba04 committed Aug 23, 2022
1 parent be07f87 commit 2de9377
Show file tree
Hide file tree
Showing 13 changed files with 579 additions and 210 deletions.
4 changes: 3 additions & 1 deletion pages/docs/advanced/cache.en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { Cache } from 'components/diagrams/cache'
When nested, SWR hooks will use the upper-level cache provider. If there is no upper-level cache provider, it fallbacks to the default cache provider, which is an empty `Map`.

<Callout emoji="⚠️">
If a cache provider is used, the global `mutate` will **not** work for SWR hooks under that `<SWRConfig>` boundary. Please use [this](#access-current-cache-provider) instead.
If a cache provider is used, the global `mutate` will **not** work for SWR hooks under that `<SWRConfig>` boundary. Please use [this](#access-current-cache-provider) instead.
</Callout>

## Access Current Cache Provider
Expand Down Expand Up @@ -197,3 +197,5 @@ const { cache } = useSWRConfig()
cache.get(key) // Get the current data for a key.
cache.clear() // ⚠️ Clear all the cache. SWR will revalidate upon re-render.
```

You can use [`mutate`](/docs/mutation) to modify the cache.
2 changes: 2 additions & 0 deletions pages/docs/advanced/cache.ja.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,5 @@ const { cache } = useSWRConfig()
cache.get(key) // キーの現在のデータを取得します。
cache.clear() // ⚠️ すべてのキャッシュをクリアします。 SWRは、再レンダリング時に再検証します。
```

[`mutate`](/docs/mutation) をキャッシュを更新するために利用できます。
2 changes: 2 additions & 0 deletions pages/docs/advanced/cache.ko.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,5 @@ const { cache } = useSWRConfig()
cache.get(key) // 키에 대한 현재 데이터 가져오기.
cache.clear() // ⚠️ 모든 캐시를 삭제하기. SWR은 다시 렌더링할 때 재검증합니다.
```

You can use [`mutate`](/docs/mutation) to modify the cache.
Loading

0 comments on commit 2de9377

Please sign in to comment.