Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ extension DefaultPokeMainUseCase: PokeMainUseCase {

public func getFriendRandomUser(randomType: PokeRandomUserType, size: Int) {
repository.getFriendRandomUser(randomType: randomType.rawValue, size: size)
.sink { event in
.sink { [weak self] event in
print("GetFriendRandomUser State: \(event)")
if case .failure = event {
self?.friendRandomUsers.send(PokeFriendRandomUserModel(randomInfoList: []))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

빈 배열을 보내면 조용한 실패로 리프레시 후 추천 친구 목록이 사라지게 되어 어색한 플로우가 될 것 같습니다.
빈 배열 대신 Error를 ViewModel에 보내 ViewModel이 네트워크 에러 모달을 띄워주도록 하는건 어떠신가요?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요 경우가 Publisher3로 use case 3개의 결과를 받아서 처리하는 부분인데,
나머지 usecase들이 빈 배열을 보내고 있어서 비슷하게 처리했습니다!

저도 어색하게 느껴지긴 했어서 나머지 usecase들이 실패했을 때에도 모달 띄우도록 수정해볼게용 !

}
} receiveValue: { [weak self] randomUsers in
self?.friendRandomUsers.send(randomUsers)
}.store(in: cancelBag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ extension SoptlogViewModel {
}.store(in: cancelBag)

input.cellTap
.filter { $0.section == .pokeLog }
.withUnretained(self)
.sink { owner, tapInfo in
switch tapInfo.row {
Expand Down