Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.filterNotNull
Expand Down Expand Up @@ -182,7 +183,7 @@ internal class SendFlowViewModel @Inject constructor(

combine(
contactCoordinator.state,
stateFlow.map { it.searchState }.flatMapLatest { snapshotFlow { it.text } }
stateFlow.map { it.searchState }.distinctUntilChanged().flatMapLatest { snapshotFlow { it.text } }
) { contactState, searchText ->
generateListItems(contactState, searchText.toString())
}.onEach { items ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.getcode.solana.keys.PublicKey
import com.getcode.util.resources.ResourceHelper
import com.getcode.view.BaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.launchIn
Expand Down Expand Up @@ -131,6 +132,7 @@ class TransactionHistoryViewModel @Inject constructor(
}

val transactions = stateFlow.mapNotNull { it.mint }
.distinctUntilChanged()
.flatMapLatest { mint -> feedCoordinator.transactions(mint) }

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class TokenInfoViewModel @Inject constructor(
eventFlow
.filterIsInstance<Event.OnBalanceUpdated>()
.mapNotNull { stateFlow.value.mint }
.distinctUntilChanged()
.flatMapLatest { mint ->
accountController.observeHasAccountFor(mint)
}
Expand Down
Loading