You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/graphcache/cache-updates.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,18 @@ cacheExchange({
59
59
});
60
60
```
61
61
62
+
## Default mutation invalidation
63
+
64
+
Starting in [Graphcache v7](https://github.com/urql-graphql/urql/blob/main/exchanges/graphcache/CHANGELOG.md#700),
65
+
mutations without a configured `updates.Mutation.<fieldName>` updater have a fallback behavior:
66
+
67
+
- If the mutation returns an entity that can't be found in the cache yet, Graphcache treats this as
68
+
a "create" mutation.
69
+
- Graphcache then invalidates cached entities of the same `__typename` as the one returned from the mutation, which can trigger related queries to refetch.
70
+
71
+
As soon as you define an updater for that mutation field, this fallback behavior no longer runs and
72
+
your updater fully controls what happens after the mutation write.
73
+
62
74
An "updater" may be attached to a `Mutation` or `Subscription` field and accepts four positional
63
75
arguments, which are the same as [the resolvers' arguments](./local-resolvers.md):
0 commit comments