diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ChannelInvite.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ChannelInvite.kt index 071e6c7935..53a227ec98 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ChannelInvite.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ChannelInvite.kt @@ -98,7 +98,12 @@ fun RenderChannelInvite( accountViewModel: AccountViewModel, nav: INav, ) { - val workspaces = accountViewModel.account.buzzWorkspaces.flow.value + // Collected, not read as .value: the workspace set arrives asynchronously (a 13534 roster landing + // after this row is first drawn), and a plain .value read is a one-shot snapshot that never + // recomposes — so an invite drawn before its workspace was known would stay blank. This is what + // Compose's StateFlowValueCalledInComposition lint flags. + val workspaces by accountViewModel.account.buzzWorkspaces.flow + .collectAsStateWithLifecycle() val notice = remember(note, workspaces) { note.toMembershipNotice(workspaces) } ?: return // A withdrawn membership is not an invite. The projection already excludes these before a card is // built; re-checked here because this renderer is reachable from any NoteCompose over a 44100. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt index a1fe6265a9..40e0960e54 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/ChatroomHeaderCompose.kt @@ -644,7 +644,11 @@ private fun ChannelInviteRoomCompose( accountViewModel: AccountViewModel, nav: INav, ) { - val workspaces = accountViewModel.account.buzzWorkspaces.flow.value + // Collected rather than read as .value, for the same reason as RenderChannelInvite: the workspace + // set lands asynchronously, and a snapshot read never recomposes, so a row drawn before its + // workspace was known would never appear. + val workspaces by accountViewModel.account.buzzWorkspaces.flow + .collectAsStateWithLifecycle() val notice = remember(inviteNote, workspaces) { inviteNote.toMembershipNotice(workspaces) } ?: return val baseChannel = remember(notice) { LocalCache.getOrCreateRelayGroupChannel(GroupId(notice.channelId, notice.relay)) }