···11+---
22+'@urql/core': patch
33+---
44+55+Return `AbortController` invocation to previous behaviour where it used to be more forceful. It will now properly abort outside of when our generator yields results, and hence now also cancels requests again that have already delivered headers but are currently awaiting a response body.
+9-9
packages/core/src/internal/fetchSource.ts
···11-import { Source, fromAsyncIterable, filter, pipe } from 'wonka';
11+import { Source, fromAsyncIterable, onEnd, filter, pipe } from 'wonka';
22import { Operation, OperationResult, ExecutionResult } from '../types';
33import { makeResult, makeErrorResult, mergeResultPatch } from '../utils';
44···108108 fetchOptions: RequestInit
109109) {
110110 let networkMode = true;
111111- let abortController: AbortController | void;
112111 let result: OperationResult | null = null;
113112 let response: Response | void;
114113115114 try {
116116- if (typeof AbortController !== 'undefined') {
117117- fetchOptions.signal = (abortController = new AbortController()).signal;
118118- }
119119-120115 // Delay for a tick to give the Client a chance to cancel the request
121116 // if a teardown comes in immediately
122117 yield await Promise.resolve();
···161156 : error,
162157 response
163158 );
164164- } finally {
165165- if (abortController) abortController.abort();
166159 }
167160}
168161···198191 url: string,
199192 fetchOptions: RequestInit
200193): Source<OperationResult> {
194194+ let abortController: AbortController | void;
195195+ if (typeof AbortController !== 'undefined') {
196196+ fetchOptions.signal = (abortController = new AbortController()).signal;
197197+ }
201198 return pipe(
202199 fromAsyncIterable(fetchOperation(operation, url, fetchOptions)),
203203- filter((result): result is OperationResult => !!result)
200200+ filter((result): result is OperationResult => !!result),
201201+ onEnd(() => {
202202+ if (abortController) abortController.abort();
203203+ })
204204 );
205205}