From a73b371e7792f085319ee934952a29902f62c180 Mon Sep 17 00:00:00 2001 From: connorsmyth Date: Tue, 22 Apr 2025 12:43:05 -0400 Subject: [PATCH] Handle already aborted controllers before re-aborting Previously, the code attempted to abort controllers without checking their state, potentially causing issues. This change ensures that controllers are only aborted if they are not already in an aborted state, improving robustness and preventing unnecessary operations. --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index f901a99..6125f97 100644 --- a/src/index.ts +++ b/src/index.ts @@ -545,7 +545,8 @@ export class UnleashClient extends TinyEmitter { private async fetchToggles() { if (this.fetch) { - if (this.abortController) { + // Check if abortController is already aborted before calling abort + if (this.abortController && !this.abortController.signal.aborted) { this.abortController.abort(); } this.abortController = this.createAbortController?.();