unneeded coroutineScope

This commit is contained in:
Avently
2025-01-21 19:02:55 +07:00
parent 4a8304b422
commit 70a8d279a0
@@ -43,7 +43,7 @@ suspend fun processLoadedChat(
contentTag: MsgContentTag?,
pagination: ChatPagination,
visibleItemIndexesNonReversed: () -> IntRange = { 0 .. 0 }
) = coroutineScope {
) {
val chatState = chatModel.chatStateForContent(contentTag)
val (splits, unreadAfterItemId, totalAfter, unreadTotal, unreadAfter, unreadAfterNewestLoaded) = chatState
val oldItems = chatModel.chatItemsForContent(contentTag).value
@@ -79,7 +79,7 @@ suspend fun processLoadedChat(
is ChatPagination.Before -> {
newItems.addAll(oldItems)
val indexInCurrentItems: Int = oldItems.indexOfFirst { it.id == pagination.chatItemId }
if (indexInCurrentItems == -1) return@coroutineScope
if (indexInCurrentItems == -1) return
val (newIds, _) = mapItemsToIds(chat.chatItems)
val wasSize = newItems.size
val (oldUnreadSplitIndex, newUnreadSplitIndex, trimmedIds, newSplits) = removeDuplicatesAndModifySplitsOnBeforePagination(
@@ -96,7 +96,7 @@ suspend fun processLoadedChat(
is ChatPagination.After -> {
newItems.addAll(oldItems)
val indexInCurrentItems: Int = oldItems.indexOfFirst { it.id == pagination.chatItemId }
if (indexInCurrentItems == -1) return@coroutineScope
if (indexInCurrentItems == -1) return
val mappedItems = mapItemsToIds(chat.chatItems)
val newIds = mappedItems.first