fix: comment loading in post detail (#1074)

This commit is contained in:
Diego Beraldin 2024-07-02 21:28:52 +02:00 committed by GitHub
parent 4540ed4214
commit ff2471ef3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 23 additions and 15 deletions

View File

@ -185,10 +185,12 @@ class CommunityDetailViewModel(
.distinctUntilChanged()
.debounce(1_000)
.onEach {
updateState { it.copy(loading = false) }
emitEffect(CommunityDetailMviModel.Effect.BackToTop)
delay(50)
refresh()
if (!uiState.value.initial) {
updateState { it.copy(loading = false) }
emitEffect(CommunityDetailMviModel.Effect.BackToTop)
delay(50)
refresh()
}
}.launchIn(this)
lemmyValueCache.isCurrentUserAdmin

View File

@ -101,7 +101,7 @@ class ModalDrawerViewModel(
uiState
.map { it.searchText }
.distinctUntilChanged()
.debounce(1000)
.debounce(1_000)
.onEach {
refresh()
}.launchIn(this)

View File

@ -169,7 +169,7 @@ class ExploreViewModel(
.map {
it.searchText
}.distinctUntilChanged()
.debounce(1000)
.debounce(1_000)
.onEach {
if (!uiState.value.initial) {
emitEffect(ExploreMviModel.Effect.BackToTop)

View File

@ -77,10 +77,12 @@ class ManageSubscriptionsViewModel(
uiState
.map { it.searchText }
.distinctUntilChanged()
.debounce(1000)
.debounce(1_000)
.onEach {
emitEffect(ManageSubscriptionsMviModel.Effect.BackToTop)
refresh()
if (!uiState.value.initial) {
emitEffect(ManageSubscriptionsMviModel.Effect.BackToTop)
refresh()
}
}.launchIn(this)
if (uiState.value.communities.isEmpty()) {
refresh(initial = true)

View File

@ -46,7 +46,7 @@ class MultiCommunityEditorViewModel(
uiState
.map { it.searchText }
.distinctUntilChanged()
.debounce(1000)
.debounce(1_000)
.onEach {
refresh()
}.launchIn(this)

View File

@ -182,9 +182,11 @@ class PostDetailViewModel(
.distinctUntilChanged()
.debounce(1_000)
.onEach {
updateState { it.copy(loading = false) }
emitEffect(PostDetailMviModel.Effect.BackToTop)
refresh()
if (!uiState.value.initial) {
updateState { it.copy(loading = false) }
emitEffect(PostDetailMviModel.Effect.BackToTop)
refresh()
}
}.launchIn(this)
identityRepository.isLogged

View File

@ -36,9 +36,11 @@ class SelectCommunityViewModel(
uiState
.map { it.searchText }
.distinctUntilChanged()
.debounce(1000)
.debounce(1_000)
.onEach {
refresh()
if (!uiState.value.initial) {
refresh()
}
}.launchIn(this)
if (uiState.value.initial) {