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): return a result in cache-only scenarios (#3459)

Co-authored-by: Phil Pluckthun <phil@kitten.sh>

authored by

Jovi De Croock
Phil Pluckthun
and committed by
GitHub
d5d3c97a 0af6e542

+12 -1
+5
.changeset/three-pandas-invent.md
··· 1 + --- 2 + '@urql/core': patch 3 + --- 4 + 5 + Fix the default `cacheExchange` crashing on `cache-only` request policies with cache misses due to `undefined` results.
+7 -1
packages/core/src/exchanges/cache.ts
··· 9 9 addMetadata, 10 10 collectTypenames, 11 11 formatDocument, 12 + makeResult, 12 13 } from '../utils'; 13 14 14 15 type ResultCache = Map<number, OperationResult>; ··· 79 80 }), 80 81 }); 81 82 82 - let result: OperationResult = cachedResult!; 83 + let result: OperationResult = 84 + cachedResult || 85 + makeResult(operation, { 86 + data: null, 87 + }); 88 + 83 89 if (process.env.NODE_ENV !== 'production') { 84 90 result = { 85 91 ...result,