Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thenable isn't cancelable anymore #612

Closed
AndyOGo opened this issue Dec 5, 2022 · 1 comment
Closed

Thenable isn't cancelable anymore #612

AndyOGo opened this issue Dec 5, 2022 · 1 comment

Comments

@AndyOGo
Copy link

AndyOGo commented Dec 5, 2022

Calling .then() on a CancelablePromise returns a Promise, which can't be canceled anymore.

Note: looking at the source .then() calls makeCancelable 🤔

then<TResult1 = T, TResult2 = never>(
onfulfilled?:
| ((
value: T
) => TResult1 | PromiseLike<TResult1> | CancelablePromise<TResult1>)
| undefined
| null,
onrejected?:
| ((
reason: any
) => TResult2 | PromiseLike<TResult2> | CancelablePromise<TResult2>)
| undefined
| null
): CancelablePromise<TResult1 | TResult2> {
return makeCancelable<TResult1 | TResult2>(
this.#promise.then(
createCallback(onfulfilled, this.#internals),
createCallback(onrejected, this.#internals)
),
this.#internals
);
}

@AndyOGo
Copy link
Author

AndyOGo commented Dec 5, 2022

Sorry, this is the wrong lib.
The issue is here
sindresorhus/p-cancelable#38

@AndyOGo AndyOGo closed this as completed Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant