+5
.changeset/moody-mice-arrive.md
+5
.changeset/moody-mice-arrive.md
···+Add `cache.link(...)` method to Graphcache. This method may be used in updaters to update links in the cache. It is hence the writing-equivalent of `cache.resolve()`, which previously didn't have any equivalent as such, which meant that only `cache.updateQuery` or `cache.writeFragment` could be used, even to update simple relations.
+33
docs/api/graphcache.md
+33
docs/api/graphcache.md
···+warning](../graphcache/errors.md#12-cant-generate-a-key-for-writefragment-or-link) when any of the+entities were passed as objects but aren't keyable, which is useful when a scalar or a non-keyable
+51
-16
docs/graphcache/cache-updates.md
+51
-16
docs/graphcache/cache-updates.md
···An "updater" may be attached to a `Mutation` or `Subscription` field and accepts four positional·········-variable and call its methods outside any `updates` functions (or functions, like `resolvers`)+Cache updates are **not** possible outside `updates`'s functions. If we attempt to store the `cache`+in a variable and call its methods outside any `updates` functions (or functions, like `resolvers`)Methods like these cannot be called outside the `cacheExchange`'s `updates` functions, because·········to our cache. We could safely add a resolver for `Todo.createdAt` and wouldn't have to worry about+As long as we're only updating links (as in 'relations') then we may also use the [`cache.link`+method](../api/graphcache.md#link). This method is the "write equivalent" of [the `cache.resolve`+method, as seen on the "Local Resolvers" page before.](./local-resolvers.md#resolving-other-fields)+We can use this method to update any relation in our cache, so the example above could also be+This method can be combined with more than just `cache.resolve`, for instance, it's a good fit with+But since this kind of data is often written automatically by the normalized cache, often updating aIn the previous section we've seen how to update data, like a list, when a mutation result enters···············
+8
-7
docs/graphcache/errors.md
+8
-7
docs/graphcache/errors.md
······-> If you're writing to the cache manually have to pass a `**typename` property on each entity in your data.+> If you're writing to the cache manually have to pass a `__typename` property on each entity in your data.You probably have called `cache.writeFragment` or `cache.updateQuery` with data that is missing a
+84
exchanges/graphcache/src/store/store.test.ts
+84
exchanges/graphcache/src/store/store.test.ts
···
+31
-1
exchanges/graphcache/src/store/store.ts
+31
-1
exchanges/graphcache/src/store/store.ts
·········
+10
exchanges/graphcache/src/types.ts
+10
exchanges/graphcache/src/types.ts
···+/** link() can be used to update a given entity field to link to another entity or entities */+/** link() can be used to update a given entity field to link to another entity or entities */