From 4e686fcc2eca21abf4b944beffdb1578ae4552b1 Mon Sep 17 00:00:00 2001 From: David Perez Date: Tue, 12 Dec 2023 12:28:55 -0600 Subject: [PATCH] Stop persisting view-item state to SavedStateHandle (#377) --- .../bitwarden/ui/vault/feature/item/VaultItemViewModel.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt index 823231f42..3188470f0 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt @@ -38,6 +38,7 @@ class VaultItemViewModel @Inject constructor( private val authRepository: AuthRepository, private val vaultRepository: VaultRepository, ) : BaseViewModel( + // We load the state from the savedStateHandle for testing purposes. initialState = savedStateHandle[KEY_STATE] ?: VaultItemState( vaultItemId = VaultItemArgs(savedStateHandle).vaultItemId, viewState = VaultItemState.ViewState.Loading, @@ -46,8 +47,6 @@ class VaultItemViewModel @Inject constructor( ) { init { - stateFlow.onEach { savedStateHandle[KEY_STATE] = it }.launchIn(viewModelScope) - combine( vaultRepository.getVaultItemStateFlow(state.vaultItemId), authRepository.userStateFlow,