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) { remember(note) {
note note
.flow() .flow()
.reactions.stateFlow .replies.stateFlow
.sample(200)
.mapLatest { it.note.replies.size } .mapLatest { it.note.replies.size }
.sample(1000)
.distinctUntilChanged() .distinctUntilChanged()
} }
@@ -215,8 +215,8 @@ fun observeNoteReactionCount(
note note
.flow() .flow()
.reactions.stateFlow .reactions.stateFlow
.sample(200)
.mapLatest { it.note.countReactions() } .mapLatest { it.note.countReactions() }
.sample(1000)
.distinctUntilChanged() .distinctUntilChanged()
.flowOn(Dispatchers.Default) .flowOn(Dispatchers.Default)
} }
@@ -294,7 +294,7 @@ fun observeNoteRepostCount(
note note
.flow() .flow()
.boosts.stateFlow .boosts.stateFlow
.sample(1000) .sample(200)
.mapLatest { note.boosts.size } .mapLatest { note.boosts.size }
.distinctUntilChanged() .distinctUntilChanged()
} }

View File

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