Kshitij Patil
01/14/2021, 10:57 AMPagingData
everytime we search with new query. Although it's true that every flow is going to be different, don't you think that we could have used `SharedFlow`s here somehow?Dustin Lam
01/14/2021, 4:52 PMDustin Lam
01/14/2021, 4:53 PMDustin Lam
01/14/2021, 4:57 PMDustin Lam
01/14/2021, 4:59 PMpager(..).flow
.cachedIn(scope)
.combine(queryFlow) { pagungData, query ->
pagingData.filter { it.contains(query) }
}
Dustin Lam
01/14/2021, 4:59 PMDustin Lam
01/14/2021, 5:00 PMKshitij Patil
01/15/2021, 2:24 PMMutableStateFlow
in viewModels which will be updated on edittext text changes, debounce those updates and make fetch call appropriately. The fetch method will get a new Flow
of PagingData
and I’m emitting each PagingData
to an Immutable state object I maintain in viewmodel (LiveData of State). The LiveData is thus observed in the Fragment and submiited to RecyclerVIew
adapter. How does this sound? Also, the fetch call job references are kept and I do cancel the old one same as the codelab (just everything is done in ViewModel)