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(auth): Fix authExchange’s retry queue ignoring teardowns (#3235)

authored by

Phil Pluckthun and committed by
GitHub
9bf55832 c356285e

+11 -13
+5
.changeset/weak-eagles-walk.md
··· 1 + --- 2 + '@urql/exchange-auth': patch 3 + --- 4 + 5 + Fix regression that caused teardowns to be ignored by an `authExchange`’s retry queue.
+6 -13
exchanges/auth/src/authExchange.ts
··· 306 306 return config ? config.addAuthToOperation(operation) : operation; 307 307 } 308 308 309 - const teardownOps$ = pipe( 310 - operations$, 311 - filter(operation => operation.kind === 'teardown') 312 - ); 313 - 314 - const pendingOps$ = pipe( 315 - operations$, 316 - filter(operation => operation.kind !== 'teardown') 317 - ); 318 - 319 309 const opsWithAuth$ = pipe( 320 - merge([retries.source, pendingOps$]), 310 + merge([retries.source, operations$]), 321 311 map(operation => { 322 - if ( 312 + if (operation.kind === 'teardown') { 313 + retryQueue.delete(operation.key); 314 + return operation; 315 + } else if ( 323 316 operation.context._instance && 324 317 bypassQueue.has(operation.context._instance) 325 318 ) { ··· 346 339 filter(Boolean) 347 340 ) as Source<Operation>; 348 341 349 - const result$ = pipe(merge([opsWithAuth$, teardownOps$]), forward); 342 + const result$ = pipe(opsWithAuth$, forward); 350 343 351 344 return pipe( 352 345 result$,