diff --git a/apps/ios/Shared/Views/Chat/ComposeMessage/ContextProfilePickerView.swift b/apps/ios/Shared/Views/Chat/ComposeMessage/ContextProfilePickerView.swift index 52fa8a0b07..aa09b563bd 100644 --- a/apps/ios/Shared/Views/Chat/ComposeMessage/ContextProfilePickerView.swift +++ b/apps/ios/Shared/Views/Chat/ComposeMessage/ContextProfilePickerView.swift @@ -269,19 +269,19 @@ struct ContextProfilePickerView: View { if newUser.activeUser { // An older remote host ignored keepActiveUser, so the reassignment would // fail. Resync and report - not rethrown, or the form blames the creation. - let switched: Bool do { try await changeActiveUserAsync_(newUser.userId, viewPwd: nil) - switched = true } catch { logger.error("changeActiveUserAsync_ error: \(responseError(error))") - switched = false } await MainActor.run { // Unconditional: the switch only removes this view when it succeeded showAddProfile = false - // Only if it switched: the chat is then gone from the list and renders blank - if switched && chatModel.chatId == chat.id { chatModel.chatId = nil } + // Only if it switched, which the active user tells us: the prepared chat + // is then gone from the reloaded list and would render blank. + if chatModel.currentUser?.userId == newUser.userId && chatModel.chatId == chat.id { + chatModel.chatId = nil + } } alertAfterDismissal(NSLocalizedString("Error changing chat profile", comment: "alert title")) return diff --git a/apps/ios/Shared/Views/NewChat/NewChatView.swift b/apps/ios/Shared/Views/NewChat/NewChatView.swift index 7fcd042714..067478d4f8 100644 --- a/apps/ios/Shared/Views/NewChat/NewChatView.swift +++ b/apps/ios/Shared/Views/NewChat/NewChatView.swift @@ -610,9 +610,11 @@ private struct ActiveProfilePicker: View { // with the previous one, so a second attempt would fail the same way. await MainActor.run { showAddProfile = false - // Make the picker agree with the profile that is now active profileSwitchStatus = .idle - selectedProfile = newUser + // Whatever the resync above ended up with - newUser if it switched, the + // previous profile if it threw. Not newUser unconditionally, or a failed + // switch leaves the checkmark on a profile that is not active. + selectedProfile = chatModel.currentUser ?? selectedProfile } alertAfterDismissal(NSLocalizedString("Error changing chat profile", comment: "alert title")) return