Reputation: 649
In rx code, .disposed get called without any doing job like flatmap, subscribe. This happens only when I build my app at first time.
Does anybody knows what happens here?
This is my code
HTTP.getSomething()
.flatMap { (list) -> Single<Void> in
return HTTP.getList(withList: list)
}
.subscribe(onSuccess: { (storeList) in
log.debug("Finish!!!")
}, onError: { [weak self] (error) in
self?.presentAlert(error: error)
})
.disposed(by: self.disposeBag)
Upvotes: 0
Views: 668
Reputation: 33967
The only way the code you presented can possibly be disposed without attempting the work inside of the flatMap is if getSomething
emits a completed without emitting a value, or if it emits an error, or if the disposeBag is deleted. One of those three things is happening.
Since you say it only happens on first build, I suspect that getSomething
is trying to make a network call before it has all the info it needs which is causing it to emit an error.
Upvotes: 1