fix total count cursor result sharing

This commit is contained in:
Ivan Smolin 2017-11-12 22:07:46 +03:00
parent b0e3463581
commit 9a47fff654
1 changed files with 6 additions and 5 deletions

View File

@ -65,18 +65,19 @@ public final class TotalCountCursor<LT, ET, CC: TotalCountCursorConfiguration>:
.map { [configuration] listing in
configuration.getResult(from: listing)
}
.asObservable()
.share()
let driverListing = sharedListing
.asDriver(onErrorJustReturn: CC.ResultTuple([], .max))
driverListing
sharedListing
.map { $0.totalCount }
.asDriver(onErrorJustReturn: .max)
.filter { $0 != .max }
.drive(totalCountVariable)
.disposed(by: disposeBag)
let newProductsDriver = driverListing
let newProductsDriver = sharedListing
.map { $0.results }
.asDriver(onErrorJustReturn: [])
.filterEmpty()
Driver