From 8467d5ff1737e910b6a6a1c1060a5cc44e1e44a3 Mon Sep 17 00:00:00 2001 From: Diogo Date: Wed, 16 Oct 2024 10:04:40 +0100 Subject: [PATCH] reset sections --- apps/ios/Shared/Views/Chat/ChatView.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index af0251360a..bdacacc5d0 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -370,6 +370,10 @@ struct ChatView: View { } } ChatView.FloatingButtonModel.shared.totalUnread = chat.chatStats.unreadCount + resetSections() + } + + private func resetSections() { itemSection.removeAll() im.reversedChatItems.forEach { itemSection[$0.id] = .bottom @@ -458,7 +462,10 @@ struct ChatView: View { .padding(.vertical, -InvertedTableView.inset) .onTapGesture { hideKeyboard() } .onChange(of: searchText) { _ in - Task { await loadChat(chat: chat, search: searchText) } + Task { + await loadChat(chat: chat, search: searchText) + resetSections() + } } .onChange(of: im.itemAdded) { added in if added {