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