diff --git a/docs/source/caching/advanced-topics.mdx b/docs/source/caching/advanced-topics.mdx index 43a741228db..6e8460b4077 100644 --- a/docs/source/caching/advanced-topics.mdx +++ b/docs/source/caching/advanced-topics.mdx @@ -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`. + + +The `persistCache` method is async and returns a `Promise`. + + ```js import AsyncStorage from '@react-native-async-storage/async-storage'; @@ -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 @@ -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/). + + +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/). + + ## Cache redirects @@ -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. + + +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. + + ## Pagination utilities