Skip to content

Commit

Permalink
[sitecore-jss] Undefined AbortController (#1084)
Browse files Browse the repository at this point in the history
* fixed abortController not defined issue

* updated yarn.lock
  • Loading branch information
addy-pathania authored Jun 30, 2022
1 parent 8513a6f commit a2700e1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/sitecore-jss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"typescript": "~4.3.5"
},
"dependencies": {
"abort-controller": "^3.0.0",
"axios": "^0.21.1",
"chalk": "^4.1.0",
"debug": "^4.3.1",
Expand Down
1 change: 1 addition & 0 deletions packages/sitecore-jss/src/graphql-request-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { RequestInit } from 'graphql-request/dist/types.dom';
import parse from 'url-parse';
import { DocumentNode } from 'graphql';
import debuggers, { Debugger } from './debug';
import AbortController from 'abort-controller';

/**
* An interface for GraphQL clients for Sitecore APIs
Expand Down
3 changes: 2 additions & 1 deletion packages/sitecore-jss/src/native-fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { HttpResponse } from './data-fetcher';
import debuggers, { Debugger } from './debug';
import AbortController from 'abort-controller';

type NativeDataFetcherOptions = {
/**
Expand Down Expand Up @@ -33,7 +34,7 @@ export class NativeDataFetcher {
const abortController = new AbortController();
const debug = debugOverride || debuggers.http;
const requestInit = this.getRequestInit(init, data);
requestInit.signal = abortController.signal;
requestInit.signal = abortController.signal as AbortSignal;

let abortTimeout: NodeJS.Timeout;
if (init.timeout) {
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4144,6 +4144,7 @@ __metadata:
"@types/mocha": ^9.0.0
"@types/node": ^16.11.6
"@types/url-parse": 1.4.8
abort-controller: ^3.0.0
axios: ^0.21.1
chai: ^4.2.0
chai-spies: ^1.0.0
Expand Down

0 comments on commit a2700e1

Please sign in to comment.