Giter Site home page Giter Site logo

Comments (4)

wmertens avatar wmertens commented on May 3, 2024

Promise cancellation is still under discussion. Whatwg fetch (the next-gen xhr) is discussion cancellable fetching separate from promises here: whatwg/fetch#27 (interesting but very long)

from redux-saga.

yelouafi avatar yelouafi commented on May 3, 2024

@aft-luke I think the undefined issue is that you dont return a value from doFetch (return (yield req = ...))

Regarding cancellation, redux-saga cancels only the effects it creates itself (called sagas, take effects). raw promise cancellation is a no-op since this is not yet supported by the standard.

from redux-saga.

 avatar commented on May 3, 2024

I realize cancellation is not standard yet, but my favorite promise library bluebird does support cancellation, and I have a decorated/promisified xhr library that will xhr.abort() when told.

Thanks again @yelouafi, you are right. I'm not sure I totally understand the syntax here, but return (yield someVar = ... )) makes someVar declared inside a catch block.

from redux-saga.

aikoven avatar aikoven commented on May 3, 2024

@aft-luke redux-saga/lib/proc module exports CANCEL symbol. You can use it to add cancellation to any promise:

import {CANCEL} from 'redux-saga/lib/proc';

promise[CANCEL] = () => { /* cancellation logic */ }

from redux-saga.

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.