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

fix(graphcache): Fix offlineExchange’s failed queue not being filtered for teardowns (#3236)

Changed files
+9
.changeset
exchanges
graphcache
+5
.changeset/pretty-dodos-happen.md
···
+
---
+
'@urql/exchange-graphcache': patch
+
---
+
+
Fix torn down queries not being removed from `offlineExchange`’s failed queue on rehydration.
+4
exchanges/graphcache/src/offlineExchange.ts
···
onPush(operation => {
if (operation.kind === 'query' && !hasRehydrated) {
failedQueue.push(operation);
+
} else if (operation.kind === 'teardown') {
+
for (let i = failedQueue.length - 1; i >= 0; i--)
+
if (failedQueue[i].key === operation.key)
+
failedQueue.splice(i, 1);
}
})
),