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

fix(auth): Fix authExchange’s retry queue ignoring teardowns (#3235)

Changed files
+11 -13
.changeset
exchanges
auth
+5
.changeset/weak-eagles-walk.md
···
+
---
+
'@urql/exchange-auth': patch
+
---
+
+
Fix regression that caused teardowns to be ignored by an `authExchange`’s retry queue.
+6 -13
exchanges/auth/src/authExchange.ts
···
return config ? config.addAuthToOperation(operation) : operation;
}
-
const teardownOps$ = pipe(
-
operations$,
-
filter(operation => operation.kind === 'teardown')
-
);
-
-
const pendingOps$ = pipe(
-
operations$,
-
filter(operation => operation.kind !== 'teardown')
-
);
-
const opsWithAuth$ = pipe(
-
merge([retries.source, pendingOps$]),
+
merge([retries.source, operations$]),
map(operation => {
-
if (
+
if (operation.kind === 'teardown') {
+
retryQueue.delete(operation.key);
+
return operation;
+
} else if (
operation.context._instance &&
bypassQueue.has(operation.context._instance)
) {
···
filter(Boolean)
) as Source<Operation>;
-
const result$ = pipe(merge([opsWithAuth$, teardownOps$]), forward);
+
const result$ = pipe(opsWithAuth$, forward);
return pipe(
result$,