Tower Guidev2
11/21/2022, 11:54 AMChris Fillmore
11/21/2022, 12:44 PMsnapshotFlow
. LaunchedEffect
is restarting because of the configuration change. Put your snapshotFlow into your ViewModel and the problem should go away.Tower Guidev2
11/21/2022, 1:59 PMChris Fillmore
11/21/2022, 2:29 PMTower Guidev2
11/21/2022, 2:35 PMfun displayItem(context: Context) = viewmodelScope.launch {
snapshotFlow { displayItemState }
.filter { it.viewIntent != null }
.collectLatest { displayItemState ->
context.startActivity(displayItemState.viewIntent)
}
}
Tower Guidev2
11/21/2022, 2:36 PMZun
11/21/2022, 4:09 PM