-
Notifications
You must be signed in to change notification settings - Fork 189
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
Comments
Yeh the CANCELLED action type sounds perfect |
No, it's a terrible idea. Cancelling is another kind of rejection. Such change would introduce the whole universe of brittleness. |
From the proposal: "canceled is a third state, alongside fulfilled and rejected." |
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. |
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. |
This proposal has been withdrawn. Closing the issue. |
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.
The text was updated successfully, but these errors were encountered: