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(graphcache): default storage not clearing idb batch result (#2458)

* fix default storage not clearing idb batch result

* Update two-masks-draw.md

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

authored by

Jovi De Croock
Phil Pluckthun
and committed by
GitHub
232310fa 9215f1a0

+7 -1
+5
.changeset/two-masks-draw.md
··· 1 + --- 2 + '@urql/exchange-graphcache': patch 3 + --- 4 + 5 + Fix default storage persisting data after `clear()` was called on it
+2 -1
exchanges/graphcache/src/default-storage/index.ts
··· 40 40 const ENTRIES_STORE_NAME = 'entries'; 41 41 const METADATA_STORE_NAME = 'metadata'; 42 42 43 - const batch: Record<string, string | undefined> = Object.create(null); 43 + let batch: Record<string, string | undefined> = Object.create(null); 44 44 const timestamp = Math.floor(new Date().valueOf() / (1000 * 60 * 60 * 24)); 45 45 const maxAge = timestamp - (opts.maxAge || 7); 46 46 ··· 105 105 ); 106 106 transaction.objectStore(METADATA_STORE_NAME).clear(); 107 107 transaction.objectStore(ENTRIES_STORE_NAME).clear(); 108 + batch = Object.create(null); 108 109 return getTransactionPromise(transaction); 109 110 }); 110 111 },