Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
Improve library loading
Browse files Browse the repository at this point in the history
  • Loading branch information
jobobby04 committed Aug 18, 2022
1 parent 4115cae commit 54296bf
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package app.shosetsu.android.viewmodel.impl
*/

import androidx.compose.ui.state.ToggleableState
import androidx.lifecycle.viewModelScope
import app.shosetsu.android.common.enums.InclusionState
import app.shosetsu.android.common.enums.InclusionState.EXCLUDE
import app.shosetsu.android.common.enums.InclusionState.INCLUDE
Expand All @@ -40,8 +41,10 @@ import app.shosetsu.android.view.uimodels.model.CategoryUI
import app.shosetsu.android.view.uimodels.model.LibraryNovelUI
import app.shosetsu.android.view.uimodels.model.LibraryUI
import app.shosetsu.android.viewmodel.abstracted.ALibraryViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.plus
import java.util.Locale.getDefault as LGD

/**
Expand Down Expand Up @@ -238,7 +241,11 @@ class LibraryViewModel(
.combineUnreadStatus()
.combineSortType()
.combineSortReverse()
.combineFilter().onIO()
.combineFilter()
// Replay the latest library for library re-load
.shareIn(viewModelScope + Dispatchers.IO, SharingStarted.Lazily, replay = 1)
.distinctUntilChanged()
.onIO()
}

override val columnsInH by lazy {
Expand Down

0 comments on commit 54296bf

Please sign in to comment.