desktop: fix freeze that happened when new chat items arrives while scrolling via scrollbar (#4050)

This commit is contained in:
Stanislav Dmitrenko
2024-04-19 21:57:00 +07:00
committed by GitHub
parent 648884044f
commit 918be31f2c
@@ -1090,9 +1090,9 @@ private fun ScrollToBottom(chatId: ChatId, listState: LazyListState, chatItems:
.collect {
try {
if (listState.firstVisibleItemIndex == 0 || (listState.firstVisibleItemIndex == 1 && listState.layoutInfo.totalItemsCount == chatItems.size)) {
listState.animateScrollToItem(0)
if (appPlatform.isAndroid) listState.animateScrollToItem(0) else listState.scrollToItem(0)
} else {
listState.animateScrollBy(scrollDistance)
if (appPlatform.isAndroid) listState.animateScrollBy(scrollDistance) else listState.scrollBy(scrollDistance)
}
} catch (e: CancellationException) {
/**