Code Monkey home page Code Monkey logo

Comments (9)

s4cha avatar s4cha commented on May 8, 2024

@piterlouis this is brilliant! Even if we usually use Async code in promises, this definitely is a bug indeed.
I can reproduce it on my end and your fix works like a charm :)
Would you mind creating a pull request for this?
Thank you so much for your help 👍

from then.

s4cha avatar s4cha commented on May 8, 2024

By the way I could reproduce the exact same bug with the other syntax below :

promiseA().then { _ -> Promise<Int> in
    return promiseB()
}.then { _ -> Promise<Int> in
    return promiseC()
}.then {  r in
    print(r)
}

which should be the exact equivalent than promiseA().then(promiseB()).then(promiseC()).

Once again it works perfectly if promiseA is Asynchronous but not if A is synchronous. This will need a separate fix though.

from then.

s4cha avatar s4cha commented on May 8, 2024

Actually we need to fix this further down, as explained before, the two syntaxes should do the same. so we rewrote the function taking a promise as a parameter like so :

public func then<X>(p:Promise<X>) -> Promise<X>{
    return then { _ in p }
}

Now our fix (yet to be found) will fix the two issues described above :)

from then.

s4cha avatar s4cha commented on May 8, 2024

Hey @piterlouis, we just pushed a fix on "dev" branch, could you confirm that it fixes your issue?

from then.

piterlouis avatar piterlouis commented on May 8, 2024

Ey @s4cha, the fix works perfect!. Thanks you a lot for your code and time!!

from then.

chetem avatar chetem commented on May 8, 2024

I was having this same issue, glad to see it fixed! Any chance the changes will be pushed up to Cocoapods?

from then.

s4cha avatar s4cha commented on May 8, 2024

@chetem Indeed this wasn't pushed to CocoaPods. Can you confirm this is fixed?

from then.

chetem avatar chetem commented on May 8, 2024

Yep! I used the latest source code in one of my projects and everything seems to be working as expected!

from then.

s4cha avatar s4cha commented on May 8, 2024

@chetem great !

from then.

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.