diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index 812a6d214e..d85fd73714 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -359,6 +359,7 @@ struct ChatView: View { revealedItems = Set() stopAudioPlayer() if let cId { + chatModel.membersLoaded = false if let c = chatModel.getChat(cId) { chat = c } diff --git a/apps/ios/Shared/Views/Chat/Group/MemberSupportView.swift b/apps/ios/Shared/Views/Chat/Group/MemberSupportView.swift index 0a091bc62d..3c0cbe987b 100644 --- a/apps/ios/Shared/Views/Chat/Group/MemberSupportView.swift +++ b/apps/ios/Shared/Views/Chat/Group/MemberSupportView.swift @@ -20,7 +20,7 @@ struct MemberSupportView: View { var body: some View { viewBody() .onAppear { - if !chatModel.membersLoaded || chatModel.groupMembers.first?.wrapped.groupId != groupInfo.groupId { + if !chatModel.membersLoaded { Task { await chatModel.loadGroupMembers(groupInfo) } diff --git a/plans/member-support-list-events.md b/plans/member-support-list-events.md index 22dfda04df..e1abc83ec8 100644 --- a/plans/member-support-list-events.md +++ b/plans/member-support-list-events.md @@ -50,6 +50,7 @@ Load the list once per open group, then keep it current from what arrives. - `JoinedGroupMember` and `JoinedGroupMemberConnecting` are emitted right after the "new member pending review" item, and they carry the member with zero support stats. Their handlers keep the support stats already in the list, so they do not erase the badge the item event just set. On Kotlin that item event can also be applied after them; the merge covers either order. - The member list loads only if `membersLoaded` is false. The mention picker already uses this flag the same way, and it is reset when leaving the group. - `apiListMembers` returns `null`/`nil` on error on both platforms, and the member load then keeps the current state, so a failed load does not mark members as loaded. iOS still runs the load's completion, so group info still opens. +- iOS resets `membersLoaded` when the open chat changes without going through the chat list (notification tap, "forwarded from", member info), as Kotlin already does, because group info can be opened without reloading members. - iOS resets `membersLoaded` when chats are refreshed on resume, because the notification extension may have changed support chats while the app was suspended. - Kotlin `upsertGroupMember` also resets `membersLoaded` when it clears another group's stale members. - Kotlin `setGroupMembers` now writes on the main thread, where all upserts run, so an upsert can no longer land between clearing the index and rebuilding it and add a duplicate. It writes its result only if the group is still the open chat (or the channel being created), as iOS `loadGroupMembers` already does. Without this check, a slow load from a previously opened channel could finish after a chat switch and mark another group's members as loaded. The old reload on every return hid that.