From 7e45042c275c605f6e25bb34d1f5e9a081d95d07 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 20 Apr 2026 15:58:00 +0000 Subject: [PATCH] fix: refresh Marmot group members list when returning to info screen Replace LaunchedEffect with LifecycleResumeEffect so the members list (and chatroom.memberCount) is re-queried every time MarmotGroupInfoScreen resumes, not just when nostrGroupId changes. Previously, after adding a member via the AddMemberScreen and popping back, the members count displayed in the header and chat top bar stayed stale until the screen was fully recreated. --- .../loggedIn/chats/marmotGroup/MarmotGroupInfoScreen.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupInfoScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupInfoScreen.kt index a724f2f53..1979c6076 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupInfoScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/marmotGroup/MarmotGroupInfoScreen.kt @@ -47,7 +47,6 @@ import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -59,6 +58,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.LifecycleResumeEffect import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.commons.marmot.GroupMemberInfo import com.vitorpamplona.amethyst.ui.navigation.navs.INav @@ -92,9 +92,10 @@ fun MarmotGroupInfoScreen( val myPubkey = accountViewModel.account.signer.pubKey val context = LocalContext.current - LaunchedEffect(nostrGroupId) { + LifecycleResumeEffect(nostrGroupId) { members = accountViewModel.marmotGroupMembers(nostrGroupId) chatroom.memberCount.value = members.size + onPauseOrDispose {} } Scaffold(