Code Monkey home page Code Monkey logo

Comments (6)

tomatau avatar tomatau commented on May 18, 2024

Yeh the CANCELLED action type sounds perfect

from redux-promise-middleware.

steida avatar steida commented on May 18, 2024

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

from redux-promise-middleware.

pburtchaell avatar pburtchaell commented on May 18, 2024

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

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

from redux-promise-middleware.

steida avatar steida commented on May 18, 2024

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.

from redux-promise-middleware.

tomatau avatar tomatau commented on May 18, 2024

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.

from redux-promise-middleware.

pburtchaell avatar pburtchaell commented on May 18, 2024

This proposal has been withdrawn. Closing the issue.

from redux-promise-middleware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.