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.
This commit is contained in:
+3
-2
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user