Skip to content

Commit fa98a92

Browse files
Cache history in view model
1 parent 38645b0 commit fa98a92

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

app/src/main/java/org/schabi/newpipe/local/history/HistoryViewModel.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import androidx.lifecycle.SavedStateHandle
66
import androidx.lifecycle.viewModelScope
77
import androidx.paging.Pager
88
import androidx.paging.PagingConfig
9+
import androidx.paging.cachedIn
910
import androidx.paging.map
1011
import kotlinx.coroutines.Dispatchers
1112
import kotlinx.coroutines.flow.flatMapLatest
@@ -48,6 +49,7 @@ class HistoryViewModel(
4849
}
4950
}
5051
.flowOn(Dispatchers.IO)
52+
.cachedIn(viewModelScope)
5153

5254
fun updateOrder(sortKey: SortKey) {
5355
savedStateHandle[ORDER_KEY] = sortKey

0 commit comments

Comments
 (0)