diff --git a/docs/source/api/cache/InMemoryCache.mdx b/docs/source/api/cache/InMemoryCache.mdx index c439181d308..1e488d927dd 100644 --- a/docs/source/api/cache/InMemoryCache.mdx +++ b/docs/source/api/cache/InMemoryCache.mdx @@ -146,7 +146,7 @@ readQuery( Writes data to the cache in the shape of a provided GraphQL query. Returns a `Reference` to the written object or `undefined` if the write failed. -For usage instructions, see [Interacting with cached data: `writeQuery`](../../caching/cache-interaction/#writequery-and-writefragment). +For usage instructions, see [Interacting with cached data: `writeQuery`](../../caching/cache-interaction/#writequery). Takes an `options` object as a parameter. Supported fields of this object are described below. @@ -398,7 +398,7 @@ readFragment( Writes data to the cache in the shape of the provided GraphQL fragment. Returns a `Reference` to the written object or `undefined` if the write failed. -For usage instructions, see [Interacting with cached data: `writeFragment`](../../caching/cache-interaction/#writequery-and-writefragment). +For usage instructions, see [Interacting with cached data: `writeFragment`](../../caching/cache-interaction/#writefragment). Takes an `options` object as a parameter. Supported fields of this object are described below. @@ -567,7 +567,7 @@ Modifies one or more field values of a cached object. Must provide a **modifier Returns `true` if the cache was modified successfully and `false` otherwise. -For usage instructions, see [`cache.modify`](../../caching/cache-interaction/#cachemodify). +For usage instructions, see [Using `cache.modify`](../../caching/cache-interaction/#using-cachemodify). Takes an `options` object as a parameter. Supported fields of this object are described below. diff --git a/docs/source/api/react/hoc.mdx b/docs/source/api/react/hoc.mdx index ac866d19298..667e9fb9e69 100644 --- a/docs/source/api/react/hoc.mdx +++ b/docs/source/api/react/hoc.mdx @@ -902,7 +902,7 @@ This option allows you to update your store based on your mutation’s result. B `options.update` takes two arguments. The first is an instance of a `DataProxy` object which has some methods which will allow you to interact with the data in your store. The second is the response from your mutation - either the optimistic response, or the actual response returned by your server (see the mutation result described in the [mutation render prop](./components/#render-prop-function-1) section for more details). -In order to change the data in your store call methods on your `DataProxy` instance like [`writeQuery` and `writeFragment`](../../caching/cache-interaction/#writequery-and-writefragment). This will update your cache and reactively re-render any of your GraphQL components which are querying affected data. +In order to change the data in your store call methods on your `DataProxy` instance like [`writeQuery`](../../caching/cache-interaction/#writequery) and [`writeFragment`](../../caching/cache-interaction/#writefragment). This will update your cache and reactively re-render any of your GraphQL components which are querying affected data. To read the data from the store that you are changing, make sure to use methods on your `DataProxy` like [`readQuery`](../../caching/cache-interaction/#readquery) and [`readFragment`](../../caching/cache-interaction/#readfragment). diff --git a/docs/source/caching/cache-interaction.md b/docs/source/caching/cache-interaction.md index 88ef57adf7c..b4ec88da1c5 100644 --- a/docs/source/caching/cache-interaction.md +++ b/docs/source/caching/cache-interaction.md @@ -60,7 +60,7 @@ If your cache contains data for _all_ of the query's fields, `readQuery` returns } ``` -**Do not modify this object directly.** The same object might be returned to multiple components. To update data in the cache, instead create a replacement object and pass it to [`writeQuery`](#writequery-and-writefragment). +**Do not modify this object directly.** The same object might be returned to multiple components. To update data in the cache, instead create a replacement object and pass it to [`writeQuery`](#writequery). If the cache is missing data for _any_ of the query's fields, `readQuery` returns `null`. It does _not_ attempt to fetch data from your GraphQL server. @@ -448,7 +448,7 @@ const invisibleManBook = { }; ``` -If we want to interact with this object in our cache with methods like [`writeFragment`](#writequery-and-writefragment) or [`cache.modify`](#cachemodify), we need the object's identifier. Our `Book` type's identifier appears to be custom, because the `id` field isn't present. +If we want to interact with this object in our cache with methods like [`writeFragment`](#writefragment) or [`cache.modify`](#using-cachemodify), we need the object's identifier. Our `Book` type's identifier appears to be custom, because the `id` field isn't present. Instead of needing to look up that our `Book` type uses the `isbn` field as its identifier, we can use the `cache.identify` method, like so: diff --git a/docs/source/local-state/managing-state-with-field-policies.mdx b/docs/source/local-state/managing-state-with-field-policies.mdx index 7951a8b9f26..bb7871c7ff2 100644 --- a/docs/source/local-state/managing-state-with-field-policies.mdx +++ b/docs/source/local-state/managing-state-with-field-policies.mdx @@ -228,7 +228,7 @@ As in the earlier `useQuery` example, whenever the `cartItemsVar` variable is up Storing local state directly in the Apollo Client cache provides some advantages, but usually requires more code than [using reactive variables](#storing-local-state-in-reactive-variables): * You don't _have_ to [define a field policy](#defining) for local-only fields that are present in the cache. If you query a field that doesn't define a `read` function, by default Apollo Client attempts to fetch that field's value directly from the cache. -* When you modify a cached field with [`writeQuery` or `writeFragment`](../caching/cache-interaction#writequery-and-writefragment), **every active query that includes the field automatically refreshes**. +* When you modify a cached field with [`writeQuery`](../caching/cache-interaction#writequery) or [`writeFragment`](../caching/cache-interaction#writefragment), **every active query that includes the field automatically refreshes**. #### Example