From a0969457951acdf51f12b8eb1a511fd28113f212 Mon Sep 17 00:00:00 2001 From: "haomou.chh" Date: Tue, 19 Sep 2023 14:53:02 +0800 Subject: [PATCH] fix: create a new controller before dispose, cause loop request when error --- src/fetch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fetch.ts b/src/fetch.ts index 162ea45..cf41f5f 100644 --- a/src/fetch.ts +++ b/src/fetch.ts @@ -100,7 +100,7 @@ export function fetchEventSource(input: RequestInfo, { const fetch = inputFetch ?? window.fetch; const onopen = inputOnOpen ?? defaultOnOpen; async function create() { - curRequestController = new AbortController(); + curRequestController = curRequestController || new AbortController(); try { const response = await fetch(input, { ...rest,