Fixes reply count

This commit is contained in:
Vitor Pamplona
2025-07-09 17:48:19 -04:00
parent 35005dddad
commit 123803edd3
2 changed files with 8 additions and 8 deletions

View File

@@ -176,9 +176,9 @@ fun observeNoteReplyCount(
remember(note) {
note
.flow()
.reactions.stateFlow
.replies.stateFlow
.sample(200)
.mapLatest { it.note.replies.size }
.sample(1000)
.distinctUntilChanged()
}
@@ -215,8 +215,8 @@ fun observeNoteReactionCount(
note
.flow()
.reactions.stateFlow
.sample(200)
.mapLatest { it.note.countReactions() }
.sample(1000)
.distinctUntilChanged()
.flowOn(Dispatchers.Default)
}
@@ -294,7 +294,7 @@ fun observeNoteRepostCount(
note
.flow()
.boosts.stateFlow
.sample(1000)
.sample(200)
.mapLatest { note.boosts.size }
.distinctUntilChanged()
}

View File

@@ -249,7 +249,7 @@ fun observeUserFollowCount(
user
.flow()
.followers.stateFlow
.sample(1000)
.sample(200)
.mapLatest { userState ->
userState.user.transientFollowCount() ?: 0
}.distinctUntilChanged()
@@ -303,7 +303,7 @@ fun observeUserTagFollows(
.hashtagFollows(user)
.flow()
.metadata.stateFlow
.sample(1000)
.sample(200)
.mapLatest { noteState ->
(noteState.note.event as? HashtagListEvent)?.publicAndCachedPrivateHashtags()?.sorted() ?: emptyList()
}.onStart {
@@ -345,7 +345,7 @@ fun observeUserBookmarkCount(
user
.flow()
.followers.stateFlow
.sample(1000)
.sample(200)
.mapLatest { userState ->
userState.user.latestBookmarkList?.countBookmarks() ?: 0
}.distinctUntilChanged()
@@ -385,7 +385,7 @@ fun observeUserFollowerCount(
user
.flow()
.followers.stateFlow
.sample(1000)
.sample(200)
.mapLatest { userState ->
userState.user.transientFollowerCount()
}.distinctUntilChanged()