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

Cancelable promises #77

Closed
pburtchaell opened this issue May 27, 2016 · 6 comments
Closed

Cancelable promises #77

pburtchaell opened this issue May 27, 2016 · 6 comments
Assignees

Comments

@pburtchaell
Copy link
Owner

pburtchaell commented May 27, 2016

Cancelable Promises have advanced to stage 1 at TC39. I'm creating this issue as a reminder that the middleware will need to be upgraded in the future to support this (if it becomes a part of the spec).

I imagine the middleware will simply dispatch a third action type, e.g., FOO_ACTION_CANCELLED.

Reminder: stage 1 is a feature "worth working on" so cancelable promises are speculative.

@tomatau
Copy link
Collaborator

tomatau commented May 27, 2016

Yeh the CANCELLED action type sounds perfect

@steida
Copy link

steida commented Jul 11, 2016

No, it's a terrible idea. Cancelling is another kind of rejection. Such change would introduce the whole universe of brittleness.

@pburtchaell
Copy link
Owner Author

No, it's a terrible idea. Cancelling is another kind of rejection.

From the proposal: "canceled is a third state, alongside fulfilled and rejected."

@steida
Copy link

steida commented Jul 11, 2016

And that's exactly what is wrong. It's completely against the promises principle. Hey, imagine you gave a promise to somehow. It can be resolved or rejected. Canceling is a lie in the contract.

Repository owner locked and limited conversation to collaborators Jul 11, 2016
Repository owner unlocked this conversation Jul 11, 2016
@tomatau
Copy link
Collaborator

tomatau commented Jul 11, 2016

One of the major problems with promises is that they can't be cancelled. This is why many people have turned to observables.

Cancelling is a state that is decided by the consumer of the promise, not by the promise itself (such as rejected). This is a great way to avoid things like DOM updates as a result of the promise when the necessary nodes were unmounted between the promise being started and being resolved.

Cancelling is good and does not introduce brittleness.

The only concern I can think of is when there are multiple consumers of a promise. But if they all handle the cancelled state appropriately, then it should be fine.

@pburtchaell pburtchaell changed the title Cancelable promises Implement cancelable promises support Sep 8, 2016
@pburtchaell pburtchaell changed the title Implement cancelable promises support Cancelable promises Oct 16, 2016
@pburtchaell
Copy link
Owner Author

This proposal has been withdrawn. Closing the issue.

Repository owner locked and limited conversation to collaborators Dec 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants