Fixes lack of update in follow count on the UserProfile page
This commit is contained in:
+3
-6
@@ -249,15 +249,12 @@ fun observeUserFollowCount(
|
|||||||
remember(user) {
|
remember(user) {
|
||||||
user
|
user
|
||||||
.flow()
|
.flow()
|
||||||
.followers.stateFlow
|
.follows.stateFlow
|
||||||
.sample(200)
|
.mapLatest { it.user.transientFollowCount() ?: 0 }
|
||||||
.mapLatest { userState ->
|
|
||||||
userState.user.transientFollowCount() ?: 0
|
|
||||||
}.distinctUntilChanged()
|
|
||||||
.flowOn(Dispatchers.IO)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(0)
|
return flow.collectAsStateWithLifecycle(user.transientFollowCount() ?: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
|
||||||
|
|||||||
Reference in New Issue
Block a user