From 3dd5d5c4b2530a3d5a6d0a4befba353a2d0ec00a Mon Sep 17 00:00:00 2001 From: maxmoney21m Date: Sat, 4 Mar 2023 15:03:46 +0800 Subject: [PATCH] Add LaunchedEffect key to fix pre-existing bug --- .../com/vitorpamplona/amethyst/ui/note/ChatroomCompose.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 926636feb..4a1727088 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 @@ -82,7 +82,7 @@ fun ChatroomCompose(baseNote: Note, accountViewModel: AccountViewModel, navContr channel?.let { channel -> var hasNewMessages by remember { mutableStateOf(false) } - LaunchedEffect(key1 = notificationCache) { + LaunchedEffect(key1 = notificationCache, key2 = note) { note.createdAt()?.let { hasNewMessages = it > notificationCache.cache.load("Channel/${channel.idHex}", context) } @@ -125,7 +125,7 @@ fun ChatroomCompose(baseNote: Note, accountViewModel: AccountViewModel, navContr userToComposeOn.let { user -> var hasNewMessages by remember { mutableStateOf(false) } - LaunchedEffect(key1 = notificationCache) { + LaunchedEffect(key1 = notificationCache, key2 = note) { noteEvent?.let { hasNewMessages = it.createdAt > notificationCache.cache.load("Room/${userToComposeOn.pubkeyHex}", context) }