fix: user detail pagination

This commit is contained in:
Diego Beraldin 2023-11-23 08:46:08 +01:00
parent 44cabf3dbd
commit b15b22deb1

View File

@ -190,7 +190,7 @@ class UserDetailViewModel(
initial = initial, initial = initial,
) )
} }
mvi.scope?.launch { mvi.scope?.launch(Dispatchers.IO) {
val auth = identityRepository.authToken.value val auth = identityRepository.authToken.value
val refreshedUser = if (otherInstance.isNotEmpty()) { val refreshedUser = if (otherInstance.isNotEmpty()) {
userRepository.getOnOtherInstance( userRepository.getOnOtherInstance(
@ -265,6 +265,9 @@ class UserDetailViewModel(
refreshing = false, refreshing = false,
) )
} }
if (!itemList.isNullOrEmpty()) {
currentPage++
}
} else { } else {
val itemList = userRepository.getComments( val itemList = userRepository.getComments(
auth = auth, auth = auth,
@ -287,8 +290,10 @@ class UserDetailViewModel(
initial = false, initial = false,
) )
} }
if (!itemList.isNullOrEmpty()) {
currentPage++
}
} }
currentPage++
} }
} }