Comments (7)
I've come up with a solution that makes it work. But I'm not sure it's elegant or correct. Some part of the code:
let stream = api.search(barcode)
|> map { $0.searchableName }
|> concat(Stream.never()) // Between stream boundaries
|> flatMap { name in
return bgg.searchGames(name, type: .Games, match: .Loose)
} |> take(1)
So basically I insert a never
stream between stream boundaries, to keep the next stream alive.
from reactkit.
Thanks for pointing out this issue.
Current flatMap()
has a different implementation compared to other Rx frameworks,
and I should say this is a bug.
Your code will be a good workaround, and I will try fixing this issue soon.
from reactkit.
Thanks @inamiy .
I've got another question regarding streams which are bound. What is the behaviour of error propagation?
let stream = api.search(barcode)
|> flatMap {
return anotherStream(...) // This stream fails via reject()
}
I have two streams concatenated via flatmap, and then the second is rejected, but stream failure or completion callback is not called. Any clues what I might be missing?
from reactkit.
@DarthMike
In your case, if anotherStream(...)
gets rejected, stream
will also get rejected.
You can register callbacks likestream.failure(callback)
or stream.then(callback)
to check its being called, but doesn't it work for you?
from reactkit.
@inamiy I subscribe via:
stream.react {
...
}.failure {
...
}
But don't receive callbacks for failure
from reactkit.
@inamiy Let me elaborate: It may be a side effect of my workaround with Stream.never().
The actual stream composition is:
let stream = api.search(barcode)
|> map { $0.searchableName }
|> concat(Stream.never())
|> flatMap { name in
return anotherStream(...)
}
I've tried pointing my code to the FlattenStyle
branch, and refactoring it to look like:
let stream = api.search(barcode)
|> map { $0.searchableName }
|> flatMap(.Concat) { name in
return anotherStream(...)
}
Then works properly with react + failure.
from reactkit.
@DarthMike
Hm, actually, I don't think concat(Stream.never())
in your first code will affect the error propagation to downstream, so it should work just similar to second code...
But anyway!
Important part is your second code, and if that's working correctly,
I think we are now able to merge #44.
Thanks for checking this issue 😊
from reactkit.
Related Issues (20)
- Replaylast or similar needed HOT 4
- Signal for selectors? HOT 2
- Signals auto deinit upon creation? HOT 2
- Push latest tag to CocoaPods HOT 1
- Making Stream error generic HOT 5
- Question: Motivation of this Repo HOT 3
- asStream returns nil value HOT 2
- Array operators return tuple instead HOT 1
- Cannot submit to the app store HOT 2
- Swift 2.0 Support HOT 1
- question - How to react? HOT 2
- Update after executing <~ HOT 1
- 2-way bindings?
- Podspec out of date HOT 1
- home page example code not working? HOT 1
- Add ignoreNil function HOT 2
- How is this different from RxSwift?
- ReactKit Swift 3 support HOT 1
- ReactKit Swift 5 not support?
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 reactkit.