oday
10/12/2022, 10:18 AMwhen (state)
to be run on each recomposition ?
cause I have the state changing from the viewmodel due to some request and something happening there that will cuase it to change, and then the when gets triggered again and the actions resulting from it happen againefemoney
10/12/2022, 11:10 AModay
10/12/2022, 11:35 AMScaffold(
topBar = {
TopAppBarBack(
title = stringResource(R.string.browse_events),
onBack = { onNavigateBack() }
)
}
) {
Column {
FilterBar(filters)
DividerFull()
when (viewModel.locationState.collectAsState().value) {
is LocationState.Disabled -> {
Log.d("LocationStatus", "BrowseEvents: Location is disabled")
onLocationDisabled()
}
is LocationState.NotSetOrNull -> {
Log.d("LocationStatus", "BrowseEvents: Location is not set or null")
and then later after that, another state I check for as well, that other state would’ve changed by the time the code reaches it, so it recomposes, so the when
above is also hit againoday
10/12/2022, 12:00 PMefemoney
10/12/2022, 12:58 PMviewmodel.locationState
property doesnt change on every access?oday
10/12/2022, 1:17 PM