From 91c47b6e87495dd5f540842579ac396efe8e0c4a Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 3 Jul 2023 08:36:12 -0400 Subject: [PATCH] BugFix for delayed update of the last messages in the Messages screen --- .../com/vitorpamplona/amethyst/ui/note/ChatroomCompose.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomCompose.kt index ac381c736..5575ba76e 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomCompose.kt @@ -150,19 +150,19 @@ private fun ChannelRoomCompose( nav: (String) -> Unit ) { val authorState by note.author!!.live().metadata.observeAsState() - val authorName = remember(authorState) { + val authorName = remember(note, authorState) { authorState?.user?.toBestDisplayName() } val chanHex = remember { channel.idHex } val channelState by channel.live.observeAsState() - val channelPicture by remember(channelState) { + val channelPicture by remember(note, channelState) { derivedStateOf { channel.profilePicture() } } - val channelName by remember(channelState) { + val channelName by remember(note, channelState) { derivedStateOf { channel.toBestDisplayName() } @@ -182,7 +182,7 @@ private fun ChannelRoomCompose( noteEvent?.content() } - var hasNewMessages = remember { mutableStateOf(false) } + val hasNewMessages = remember { mutableStateOf(false) } WatchNotificationChanges(note, route, accountViewModel) { newHasNewMessages -> if (hasNewMessages.value != newHasNewMessages) {