kopia lustrzana https://github.com/vitorpamplona/amethyst
No need to remember simple state.
rodzic
560c1f797c
commit
5a2e149fa0
|
@ -2645,19 +2645,8 @@ private fun BadgeBox(
|
|||
accountViewModel: AccountViewModel,
|
||||
nav: (String) -> Unit
|
||||
) {
|
||||
val isRepost by remember(baseNote) {
|
||||
derivedStateOf {
|
||||
baseNote.event is RepostEvent || baseNote.event is GenericRepostEvent
|
||||
}
|
||||
}
|
||||
|
||||
if (isRepost) {
|
||||
val baseReply by remember(baseNote) {
|
||||
derivedStateOf {
|
||||
baseNote.replyTo?.lastOrNull()
|
||||
}
|
||||
}
|
||||
baseReply?.let {
|
||||
if (baseNote.event is RepostEvent || baseNote.event is GenericRepostEvent) {
|
||||
baseNote.replyTo?.lastOrNull()?.let {
|
||||
RelayBadges(it, accountViewModel, nav)
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -139,19 +139,13 @@ fun UserPicture(
|
|||
accountViewModel: AccountViewModel,
|
||||
nav: (String) -> Unit
|
||||
) {
|
||||
val route by remember(user) {
|
||||
derivedStateOf {
|
||||
"User/${user.pubkeyHex}"
|
||||
}
|
||||
}
|
||||
|
||||
ClickableUserPicture(
|
||||
baseUser = user,
|
||||
size = size,
|
||||
accountViewModel = accountViewModel,
|
||||
modifier = pictureModifier,
|
||||
onClick = {
|
||||
nav(route)
|
||||
nav("User/${user.pubkeyHex}")
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -365,7 +359,10 @@ fun WatchUserFollows(userHex: String, accountViewModel: AccountViewModel, onFoll
|
|||
accountViewModel.userFollows.map {
|
||||
it.user.isFollowingCached(userHex) || (userHex == accountViewModel.account.userProfile().pubkeyHex)
|
||||
}.distinctUntilChanged()
|
||||
}.observeAsState(false)
|
||||
}.observeAsState(
|
||||
accountViewModel.account.userProfile().isFollowingCached(userHex) ||
|
||||
(userHex == accountViewModel.account.userProfile().pubkeyHex)
|
||||
)
|
||||
|
||||
onFollowChanges(showFollowingMark)
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue