fix: use relayAbort helper for addEventListener to preserve AbortError reason

This commit is contained in:
Marcus Castro
2026-02-06 20:51:04 -03:00
committed by Peter Steinberger
parent 5ac8d1d2bb
commit 7ec60d6449
5 changed files with 58 additions and 17 deletions

View File

@@ -1,3 +1,5 @@
import { bindAbortRelay } from "../utils/fetch-timeout.js";
type FetchWithPreconnect = typeof fetch & {
preconnect: (url: string, init?: { credentials?: RequestCredentials }) => void;
};
@@ -42,7 +44,7 @@ export function wrapFetchWithAbortSignal(fetchImpl: typeof fetch): typeof fetch
return fetchImpl(input, patchedInit);
}
const controller = new AbortController();
const onAbort = controller.abort.bind(controller);
const onAbort = bindAbortRelay(controller);
if (signal.aborted) {
controller.abort();
} else {