BugFix for delayed update of the last messages in the Messages screen

This commit is contained in:
Vitor Pamplona
2023-07-03 08:36:12 -04:00
parent fe4e03df39
commit 91c47b6e87
@@ -150,19 +150,19 @@ private fun ChannelRoomCompose(
nav: (String) -> Unit nav: (String) -> Unit
) { ) {
val authorState by note.author!!.live().metadata.observeAsState() val authorState by note.author!!.live().metadata.observeAsState()
val authorName = remember(authorState) { val authorName = remember(note, authorState) {
authorState?.user?.toBestDisplayName() authorState?.user?.toBestDisplayName()
} }
val chanHex = remember { channel.idHex } val chanHex = remember { channel.idHex }
val channelState by channel.live.observeAsState() val channelState by channel.live.observeAsState()
val channelPicture by remember(channelState) { val channelPicture by remember(note, channelState) {
derivedStateOf { derivedStateOf {
channel.profilePicture() channel.profilePicture()
} }
} }
val channelName by remember(channelState) { val channelName by remember(note, channelState) {
derivedStateOf { derivedStateOf {
channel.toBestDisplayName() channel.toBestDisplayName()
} }
@@ -182,7 +182,7 @@ private fun ChannelRoomCompose(
noteEvent?.content() noteEvent?.content()
} }
var hasNewMessages = remember { mutableStateOf<Boolean>(false) } val hasNewMessages = remember { mutableStateOf<Boolean>(false) }
WatchNotificationChanges(note, route, accountViewModel) { newHasNewMessages -> WatchNotificationChanges(note, route, accountViewModel) { newHasNewMessages ->
if (hasNewMessages.value != newHasNewMessages) { if (hasNewMessages.value != newHasNewMessages) {