Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(core): Set default hasNext for subscription results (#3015)

authored by

Phil Pluckthun and committed by
GitHub
208242b0 842cbaa5

+8 -2
+5
.changeset/silent-emus-brake.md
··· 1 + --- 2 + '@urql/core': patch 3 + --- 4 + 5 + Fix subscriptions not being duplicated when `hasNext` isn't set. The `hasNext` field is an upcoming "Incremental Delivery" field. When a subscription result doesn't set it we now set it to `true` manually. This indicates to the `dedupExchange` that no duplicate subscription operations should be started.
+1 -1
packages/core/src/exchanges/__snapshots__/subscription.test.ts.snap
··· 5 5 "data": {}, 6 6 "error": undefined, 7 7 "extensions": undefined, 8 - "hasNext": false, 8 + "hasNext": true, 9 9 "operation": { 10 10 "context": { 11 11 "fetchOptions": {
+2 -1
packages/core/src/utils/result.ts
··· 18 18 throw new Error('No Content'); 19 19 } 20 20 21 + const defaultHasNext = operation.kind === 'subscription'; 21 22 return { 22 23 operation, 23 24 data: result.data, ··· 29 30 : undefined, 30 31 extensions: 31 32 (typeof result.extensions === 'object' && result.extensions) || undefined, 32 - hasNext: !!result.hasNext, 33 + hasNext: result.hasNext == null ? defaultHasNext : result.hasNext, 33 34 }; 34 35 }; 35 36