Stop persisting view-item state to SavedStateHandle (#377)

This commit is contained in:
David Perez 2023-12-12 12:28:55 -06:00 committed by Álison Fernandes
parent cc48e63e89
commit 4e686fcc2e

View file

@ -38,6 +38,7 @@ class VaultItemViewModel @Inject constructor(
private val authRepository: AuthRepository,
private val vaultRepository: VaultRepository,
) : BaseViewModel<VaultItemState, VaultItemEvent, VaultItemAction>(
// 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,