Merge pull request #1627 from pitmullerIngka/fix/next-promise-resolve

fix: adjust promise resolve for next issue
This commit is contained in:
Ferdi Koomen 2023-07-28 12:02:12 +01:00 committed by GitHub
commit beccf2dede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -49,7 +49,7 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
this.#isResolved = true;
this.#resolve?.(value);
if (this.#resolve) this.#resolve(value);
};
const onReject = (reason?: any): void => {
@ -57,7 +57,7 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
this.#isRejected = true;
this.#reject?.(reason);
if (this.#reject) this.#reject(reason);
};
const onCancel = (cancelHandler: () => void): void => {
@ -120,7 +120,7 @@ export class CancelablePromise<T> implements Promise<T> {
}
}
this.#cancelHandlers.length = 0;
this.#reject?.(new CancelError('Request aborted'));
if (this.#reject) this.#reject(new CancelError('Request aborted'));
}
public get isCancelled(): boolean {

View File

@ -119,7 +119,7 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
this.#isResolved = true;
this.#resolve?.(value);
if (this.#resolve) this.#resolve(value);
};
const onReject = (reason?: any): void => {
@ -127,7 +127,7 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
this.#isRejected = true;
this.#reject?.(reason);
if (this.#reject) this.#reject(reason);
};
const onCancel = (cancelHandler: () => void): void => {
@ -3345,7 +3345,7 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
this.#isResolved = true;
this.#resolve?.(value);
if (this.#resolve) this.#resolve(value);
};
const onReject = (reason?: any): void => {
@ -3353,7 +3353,7 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
this.#isRejected = true;
this.#reject?.(reason);
if (this.#reject) this.#reject(reason);
};
const onCancel = (cancelHandler: () => void): void => {