mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
use postValue function to update searched items live data
This commit is contained in:
parent
52fc21b0ad
commit
41a978e5fc
1 changed files with 3 additions and 3 deletions
|
|
@ -72,13 +72,13 @@ class HomeViewModel @Inject constructor(
|
|||
receivedIdx = thisSearchIdx
|
||||
cursor = searchResult.cursor
|
||||
|
||||
if (searchTextLiveData.value != "") {
|
||||
if (searchTextLiveData.value != "" || clearPreviousSearch) {
|
||||
val previousItems = if (clearPreviousSearch) listOf() else searchedItems
|
||||
searchedItems = previousItems.plus(searchResult.items)
|
||||
itemsLiveData.value = searchedItems
|
||||
itemsLiveData.postValue(searchedItems)
|
||||
} else {
|
||||
items = items.plus(searchResult.items)
|
||||
itemsLiveData.value = items
|
||||
itemsLiveData.postValue(items)
|
||||
}
|
||||
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
|
|
|
|||
Loading…
Reference in a new issue