diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/detail/FavoritesViewModel.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/detail/FavoritesViewModel.kt index 8471c40d..adbd9a44 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/detail/FavoritesViewModel.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/detail/FavoritesViewModel.kt @@ -787,7 +787,9 @@ fun List.possibleFavoriteTypes(sort: Boolean) = flatMap { it.collectionType.baseItemKinds } .distinct() .filter { it in favoriteOptions } - .let { list -> + .let { + // No library for persons, so always include it + val list = it + listOf(BaseItemKind.PERSON) if (sort) { list.sortedWith(compareBy { favoriteOptions.indexOf(it) }) } else { diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/search/SearchPage.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/search/SearchPage.kt index e353287d..f20222d9 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/search/SearchPage.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/search/SearchPage.kt @@ -113,7 +113,7 @@ fun SearchPage( val focusRequesters = remember(state.includedSearchableTypes.size) { List(RESULTS_START + state.includedSearchableTypes.size) { FocusRequester() } } - val seerrActive by viewModel.seerrActive.collectAsState(initial = false) + val seerrActive by viewModel.seerrActive.collectAsState() var selectedTab by rememberSaveable(seerrActive, state.discoverEnabled) { mutableIntStateOf(0) } var showViewOptions by rememberSaveable { mutableStateOf(false) } var showFilterTypeDialog by rememberSaveable { mutableStateOf(false) } diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/search/SearchViewModel.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/search/SearchViewModel.kt index 81dfa95f..044178b2 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/search/SearchViewModel.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/search/SearchViewModel.kt @@ -43,9 +43,11 @@ import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.CancellationException import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.firstOrNull +import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import org.jellyfin.sdk.api.client.ApiClient @@ -79,7 +81,12 @@ class SearchViewModel private val navDrawerService: NavDrawerService, ) : ViewModel(), ContextMenuProvider { - val seerrActive = seerrService.active + val seerrActive = + seerrService.active.stateIn( + scope = viewModelScope, + started = SharingStarted.Eagerly, + initialValue = false, + ) private val _state = MutableStateFlow(SearchState()) val state: StateFlow = _state