Skip to content

Commit

Permalink
Guard against no support for AbortController
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Owen <[email protected]>
  • Loading branch information
kainosnoema committed Jan 13, 2023
1 parent 73b9d71 commit af9970f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/timeoutLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit af9970f

Please sign in to comment.