diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt index 3db735ecea..9e0f2bfcc0 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt @@ -167,6 +167,7 @@ object ChatModel { // rhId, chatId val deletedChats = mutableStateOf>>(emptyList()) val creatingChannelId = mutableStateOf(null) + val creatingChannelMembers = mutableStateOf>(emptyList()) val groupMembers = mutableStateOf>(emptyList()) val groupMembersIndexes = mutableStateOf>(emptyMap()) val membersLoaded = mutableStateOf(false) @@ -981,8 +982,10 @@ object ChatModel { updateGroup(rhId, groupInfo) return false } - // update current chat or channel being created - return if (chatId.value == groupInfo.id || creatingChannelId.value == groupInfo.id) { + if (creatingChannelId.value == groupInfo.id) { + creatingChannelMembers.value = creatingChannelMembers.value.filter { it.groupMemberId != member.groupMemberId } + member + } + return if (chatId.value == groupInfo.id) { if (groupMembers.value.isNotEmpty() && groupMembers.value.firstOrNull()?.groupId != groupInfo.groupId) { // stale data, should be cleared at that point, otherwise, duplicated items will be here which will produce crashes in LazyColumn groupMembers.value = emptyList() diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt index 7ad3076640..c1f621e2d5 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt @@ -141,6 +141,7 @@ fun AddChannelView(chatModel: ChatModel, rh: RemoteHostInfo?, close: () -> Unit, is ChatController.PublicGroupCreationResult.Created -> { withContext(Dispatchers.Main) { chatModel.chatsContext.updateGroup(rhId = rhId, result.groupInfo) + chatModel.creatingChannelMembers.value = emptyList() chatModel.creatingChannelId.value = result.groupInfo.id groupInfo.value = result.groupInfo groupLink.value = result.groupLink @@ -536,7 +537,7 @@ private fun ProgressStepView( } private fun relayMemberConnFailed(chatModel: ChatModel, relay: GroupRelay): String? { - return chatModel.groupMembers.value + return chatModel.creatingChannelMembers.value .firstOrNull { it.groupMemberId == relay.groupMemberId } ?.activeConn?.connFailedErr }