-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Infallible's flatMap family of operators that can return an Infallible that is not, in fact, infallible #2536
base: main
Are you sure you want to change the base?
Fix Infallible's flatMap family of operators that can return an Infallible that is not, in fact, infallible #2536
Conversation
Projects each element of an infallible sequence into a new sequence of infallible sequences and then | ||
transforms the infallible sequence of infallible sequences into an infallible sequence producing values only from the most recent infallible sequence. | ||
|
||
It is a combination of `map` + `switchLatest` operator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that switchLatest
doesn't exist for Infallible,
should this line be kept or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. It should be merged and released 🙏
Projects each element of an infallible sequence into a new sequence of infallible sequences and then | ||
transforms the infallible sequence of infallible sequences into an infallible sequence producing values only from the most recent infallible sequence. | ||
|
||
It is a combination of `map` + `switchLatest` operator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be removed to avoid misunderstandings
I think the fix could make sense indeed, but unfortunately it's a breaking API change so we can't easily merge it right now. It will have to wait for a later major version, but I'm keeping it open to not forget. Thanks! |
1198683
to
5949cbd
Compare
I believe it's a big hole in the
Infallible
contract because this will a) compile b) return anInfallible
that will fail silently, without calling any subscription closures (well maybe it will callonDispose[d]
, though, but that's beside the point):There's two ways to fix this:
Infallible
streams, and that itself returnsInfallible
.ObservableConvertibleType
and itself returnsObservable
.While 1. is better for backwards compatibility, it complicates overload resolution (
Infallible
isObservableConvertibleType
), although it seems to be working in the test code I've written.As soon as the proposed change is agreed on, I'll add tests for the first and latest variants.