reset sections

This commit is contained in:
Diogo
2024-10-16 10:04:40 +01:00
parent 04f9d53964
commit 8467d5ff17
+8 -1
View File
@@ -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 {