Skip per-folder unread queries when only the default chat folder exists.

This commit is contained in:
Greyson Parrelli
2026-06-26 15:10:31 +00:00
parent 1560be0300
commit 87fecc7379
@@ -217,7 +217,12 @@ sealed class ConversationListViewModel(
private fun loadCurrentFolders() {
viewModelScope.launch(Dispatchers.IO) {
val folders = ChatFoldersRepository.getCurrentFolders()
val unreadCountAndEmptyAndMutedStatus = ChatFoldersRepository.getUnreadCountAndEmptyAndMutedStatusForFolders(folders)
val unreadCountAndEmptyAndMutedStatus: Map<Long, Triple<Int, Boolean, Boolean>> = if (folders.size > 1) {
ChatFoldersRepository.getUnreadCountAndEmptyAndMutedStatusForFolders(folders)
} else {
emptyMap()
}
val selectedFolderId = if (currentFolder.id == -1L) {
folders.firstOrNull()?.id