diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt index fa912092d9..c202ee727b 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt @@ -5,6 +5,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.lifecycle.* import androidx.paging.PagingData +import androidx.paging.cachedIn import arrow.core.Either import arrow.core.getOrElse import com.tangem.blockchain.common.TransactionData @@ -348,15 +349,17 @@ internal class SendViewModel @Inject constructor( } private fun getTxHistory(): Flow> { - return flow { - txHistoryItemsUseCase( - userWalletId = userWalletId, - currency = cryptoCurrency, - ).fold( - ifRight = { emitAll(it.distinctUntilChanged()) }, - ifLeft = {}, - ) - } + return txHistoryItemsUseCase( + userWalletId = userWalletId, + currency = cryptoCurrency, + ).fold( + ifRight = { + it.distinctUntilChanged().cachedIn(viewModelScope) + }, + ifLeft = { + emptyFlow() + }, + ) } private fun getTxHistoryCount(): Flow {