Skip to content

Commit

Permalink
Merge pull request #1084 from wakmusic/1082-credit-loading-indicator-…
Browse files Browse the repository at this point in the history
…error

🔀 :: (#1082) 크레딧 로딩 인디케이터 동작 오류 이슈 해결
  • Loading branch information
baekteun authored Aug 12, 2024
2 parents d148b52 + 0891e87 commit 421b8c2
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ final class CreditSongListTabItemReactor: Reactor {
private let signInIsRequiredSubject = PublishSubject<Void>()

private var page: Int = 1
private var isLastPage: Bool = false
let initialState: State
private let workerName: String
private let creditSortType: CreditSongSortType
Expand Down Expand Up @@ -211,7 +212,13 @@ private extension CreditSongListTabItemReactor {
}

func reachedBottom() -> Observable<Mutation> {
guard !isLastPage else { return .empty() }
let initialCreditSongListObservable = fetchPaginatedCreditSongList()
.do(onNext: { [weak self] creditModels in
if creditModels.isEmpty || creditModels.count < Metric.pageLimit {
self?.isLastPage = true
}
})
.map { [weak self] in return $0 + (self?.currentState.songs ?? []) }
.map(Mutation.updateSongs)
return withLoadingMutation(observable: initialCreditSongListObservable)
Expand Down

0 comments on commit 421b8c2

Please sign in to comment.