Elio Maroun
04/03/2023, 11:37 AMStylianos Gakis
04/03/2023, 1:38 PMIan Lake
04/03/2023, 2:41 PMElio Maroun
04/04/2023, 9:20 AMStylianos Gakis
04/04/2023, 9:26 AMElio Maroun
04/04/2023, 9:48 AMCreateOrEditPatientEvent.CreatedPatient -> {
viewModelScope.launch {
delay(500)
_state.value = _state.value.copy(
isSaving = false
)
navController.navigateUp()
}
}
Elio Maroun
04/04/2023, 9:48 AMStylianos Gakis
04/04/2023, 10:01 AMCreatedPatient
event is called twice from your own code, so that’s an issue by itself, and has nothing to do with the navigation library. I’d start there 👀
As a side question, you got a navController instance inside your ViewModel I see, I wonder how exactly are you passing that it? Just curious.Elio Maroun
04/04/2023, 10:08 AMStylianos Gakis
04/04/2023, 10:29 AMkoinViewModel { parametersOf(navController) }
I wonder if this has any implications with process death/configuration changes and if it retains any old reference since navController is created in composition, so if there’s a configuration change and an activity recreation (if you are not preventing that), a new one will be made.
But it may be that it updates it properly with the new navController somehow, really not sure. Have you tested that yourself?Elio Maroun
04/04/2023, 10:32 AMElio Maroun
04/04/2023, 10:35 AMStylianos Gakis
04/04/2023, 10:37 AMElio Maroun
04/04/2023, 11:29 AMStylianos Gakis
04/04/2023, 11:31 AMElio Maroun
04/04/2023, 11:32 AMStylianos Gakis
04/04/2023, 11:49 AMElio Maroun
04/04/2023, 11:57 AMStylianos Gakis
04/04/2023, 12:01 PMElio Maroun
04/04/2023, 12:08 PMStylianos Gakis
04/04/2023, 12:10 PM