diff --git a/Sources/Classes/Cursors/TotalCountCursor.swift b/Sources/Classes/Cursors/TotalCountCursor.swift index b1acaf9b..c570331a 100644 --- a/Sources/Classes/Cursors/TotalCountCursor.swift +++ b/Sources/Classes/Cursors/TotalCountCursor.swift @@ -65,18 +65,19 @@ public final class TotalCountCursor: .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