···11+---
22+'@urql/core': patch
33+---
44+55+Respect `additionalTypenames` on subscriptions and re-execute queries for them as well, as one would intuitively expect.
+13-4
packages/core/src/exchanges/cache.ts
···114114 let { operation } = response;
115115 if (!operation) return;
116116117117- const typenames = collectTypesFromResponse(response.data).concat(
118118- operation.context.additionalTypenames || []
119119- );
117117+ let typenames = operation.context.additionalTypenames || [];
118118+ // NOTE: For now, we only respect `additionalTypenames` from subscriptions to
119119+ // avoid unexpected breaking changes
120120+ // We'd expect live queries or other update mechanisms to be more suitable rather
121121+ // than using subscriptions as “signals” to reexecute queries. However, if they’re
122122+ // just used as signals, it’s intuitive to hook them up using `additionalTypenames`
123123+ if (response.operation.kind !== 'subscription') {
124124+ typenames = collectTypesFromResponse(response.data).concat(typenames);
125125+ }
120126121127 // Invalidates the cache given a mutation's response
122122- if (response.operation.kind === 'mutation') {
128128+ if (
129129+ response.operation.kind === 'mutation' ||
130130+ response.operation.kind === 'subscription'
131131+ ) {
123132 const pendingOperations = new Set<number>();
124133125134 dispatchDebug({