Skip to content

Commit

Permalink
Align admonition style
Browse files Browse the repository at this point in the history
  • Loading branch information
Meschreiber committed Nov 2, 2023
1 parent 71e4194 commit ae9379b
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions docs/source/caching/advanced-topics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ You can persist and rehydrate the `InMemoryCache` from a storage provider like `

To get started, pass your cache and a storage provider to `persistCache`. By default, the contents of your cache are immediately restored asynchronously, and they're persisted on every write to the cache with a short configurable debounce interval.

> **Note:** The `persistCache` method is async and returns a `Promise`.
<Note>

The `persistCache` method is async and returns a `Promise`.

</Note>

```js
import AsyncStorage from '@react-native-async-storage/async-storage';
Expand Down Expand Up @@ -60,7 +64,7 @@ function Profile() {
}
```
> To reset the cache _without_ refetching active queries, use `client.clearStore()` instead of `client.resetStore()`.
To reset the cache _without_ refetching active queries, use `client.clearStore()` instead of `client.resetStore()`.
### Responding to cache resets
Expand Down Expand Up @@ -174,7 +178,11 @@ In these cases, you can provide a `refetchQueries` option to the `useMutation` h
For details, see [Refetching queries](../data/mutations/#refetching-queries).
> Note that although `refetchQueries` can be faster to implement than an `update` function, it also requires additional network requests that are usually undesirable. For more information, see [this blog post](https://www.apollographql.com/blog/when-to-use-refetch-queries-in-apollo-client/).
<Note>
Although `refetchQueries` can be faster to implement than an `update` function, it also requires additional network requests that are usually undesirable. For more information, see [this blog post](https://www.apollographql.com/blog/when-to-use-refetch-queries-in-apollo-client/).
</Note>
## Cache redirects
Expand Down Expand Up @@ -233,7 +241,11 @@ This `read` function uses the `toReference` helper utility to generate and retur
Now whenever a query includes the `book` field, the `read` function above executes and returns a reference to a `Book` object. Apollo Client uses this reference to look up the object in its cache and return it if it's present. If it _isn't_ present, Apollo Client knows it needs to execute the query over the network.
> ⚠️ **Note:** To avoid a network request, _all_ of a query's requested fields must already be present in the cache. If the detail view's query fetches _any_ `Book` field that the list view's query _didn't_, Apollo Client considers the cache hit to be incomplete, and it executes the full query over the network.
<Note>
To avoid a network request, _all_ of a query's requested fields must already be present in the cache. If the detail view's query fetches _any_ `Book` field that the list view's query _didn't_, Apollo Client considers the cache hit to be incomplete, and it executes the full query over the network.
</Note>
## Pagination utilities
Expand Down

0 comments on commit ae9379b

Please sign in to comment.