Comments (9)
@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.
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.
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.
Hey @piterlouis, we just pushed a fix on "dev" branch, could you confirm that it fixes your issue?
from then.
Ey @s4cha, the fix works perfect!. Thanks you a lot for your code and time!!
from then.
I was having this same issue, glad to see it fixed! Any chance the changes will be pushed up to Cocoapods?
from then.
@chetem Indeed this wasn't pushed to CocoaPods. Can you confirm this is fixed?
from then.
Yep! I used the latest source code in one of my projects and everything seems to be working as expected!
from then.
@chetem great !
from then.
Related Issues (20)
- can oc do it? HOT 5
- Add @discardableResult to await HOT 4
- Data race HOT 4
- "Incompatible Swift version - framework was built with 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1) and the local version is 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)." HOT 5
- Progress not getting called HOT 8
- Swift 5 support HOT 6
- Library name HOT 2
- .progress should be able to return Progress, not Float HOT 1
- Resolve promise on main thread HOT 4
- Can not upload update of app to App Store after name change HOT 1
- Add watchOS platform support
- Wrapping completion handlers HOT 4
- Mapping a response to `Void` HOT 1
- Xcode 11.2.1: fatal error: Unexpected Swift version HOT 3
- Cocoapods support HOT 3
- Readme code snippet typoed HOT 1
- Thread explosion causing a deadlock? HOT 1
- Warning Xcode 12: Simulator deployment target ‘IPHONEOS_DEPLOYMENT_TARGET’ is set to 8.0 HOT 1
- How about support iOS 15? HOT 4
- M1 - Apple Silicon with arm64 excluded architecture issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from then.