From af9970f0cb7eacefdb4430979d7d8ddc7ea206d6 Mon Sep 17 00:00:00 2001 From: Evan Owen Date: Fri, 13 Jan 2023 13:40:26 -0800 Subject: [PATCH] Guard against no support for AbortController Signed-off-by: Evan Owen --- src/timeoutLink.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/timeoutLink.ts b/src/timeoutLink.ts index c4e01f4..52d9723 100644 --- a/src/timeoutLink.ts +++ b/src/timeoutLink.ts @@ -96,9 +96,11 @@ export default class TimeoutLink extends ApolloLink { }; // cancel timeout if aborted from somewhere else - controller.signal.addEventListener("abort", () => { - cancelTimeout(); - }); + if (controller) { + controller.signal.addEventListener("abort", () => { + cancelTimeout(); + }); + } let ctxRef = operation.getContext().timeoutRef; if (ctxRef) {