min
07/12/2026, 7:52 AMWhen the host activity undergoes a configuration change, asynchronous work continues in the, whether it is scoped to the activity or to specific composable. This is the key to persistence.ViewModel
developer.android.com/topic/libraries/architecture/viewmodelHow can this be the case? Compositions aren’t persisted across configuration changes, are they? If a
ViewModel is scoped to a composable, shouldn’t be it cleared on configuration change?Vilgot Fredenberg
07/13/2026, 7:35 AMActivity::onRetainNonConfigurationInstance. It may be possible to preserve coroutines using retain as well, since it's based on ViewModel.Vilgot Fredenberg
07/13/2026, 7:37 AMandroid:configChanges="allKnown") to avoid worrying about activity recreation