ui: skip support list load after chat change, reload iOS list on members reset

This commit is contained in:
Narasimha-sc
2026-09-26 18:18:44 +00:00
parent ca826445ca
commit 4fc47fde19
3 changed files with 9 additions and 3 deletions
@@ -26,6 +26,13 @@ struct MemberSupportView: View {
}
}
}
.onChange(of: chatModel.membersLoaded) { loaded in
if !loaded && chatModel.chatId == groupInfo.id {
Task {
await chatModel.loadGroupMembers(groupInfo)
}
}
}
}
@ViewBuilder private func viewBody() -> some View {
@@ -42,7 +42,7 @@ fun ModalData.MemberSupportView(
ModalManager.end.closeModals()
}
LaunchedEffect(chatModel.membersLoaded.value) {
if (!chatModel.membersLoaded.value) {
if (!chatModel.membersLoaded.value && chatModel.chatId.value == groupInfo.id) {
setGroupMembers(rhId, groupInfo, chatModel)
}
}
+1 -2
View File
@@ -48,7 +48,7 @@ Load the list once per open group, then keep it current from what arrives.
- the mark-read response;
- the initial load of a support chat.
- `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. On Kotlin the load effect is keyed on `membersLoaded`, so a reset while the list is open (for example `ChatView` recomposing after an Android configuration change) reloads it. The mention picker already uses this flag the same way, and it is reset when leaving the group.
- The member list loads only if `membersLoaded` is false. On both platforms the list also reloads when `membersLoaded` is reset while it is open and its group is still the open chat. Examples are `ChatView` recomposing after an Android configuration change, and the iOS reset on resume. 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 clears the loaded members and 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 also be opened from a message avatar without reloading members, the iOS list additionally reloads unless members were loaded for this group (`membersLoadedGroupId`).
- iOS resets `membersLoaded` when chats are refreshed on resume, because the notification extension may have changed support chats while the app was suspended.
@@ -63,7 +63,6 @@ A member's first support message arrives as a `NewChatItems` event with that mem
- A full member load that is in flight when a support-chat update arrives overwrites that update with its snapshot. For example, the first list load can race a member's first support message. The member then reappears on their next message, when their chat is opened, or when the group is reopened.
- Support stats snapshots from different events and responses are applied in arrival order, so a rare reordering can briefly show an older count until the next update for that member.
- On iOS, if the list is on screen while the app resumes, changes the notification extension made while suspended appear only after the list is left and reopened.
- On iOS, handlers that update an existing member in place without publishing a change, such as "Mark read" from the context menu or accept, update the row but not the list order or filter until the next `ChatModel` change. The existing TODO in `deleteMemberSupportChat` describes the same mechanism. Previously, returning to the list also re-sorted it.
- The connection-state labels in rows (failed, disabled, inactive) come from `activeConn`. Neither app handles `ConnectionDisabled` or `ConnectionInactive`, so these labels now refresh only on the next full member event for that member (role, profile, connected) or when the group is reopened.