ok so I am using/modifying `.value` stuff inside a...
# compose
o
ok so I am using/modifying
.value
stuff inside a
when
, which yes is technically not inside a Composable, and I’m being allowed to do so, but there is a big warning about it of course how do I avoid that?
Copy code
LazyRow(
    contentPadding = PaddingValues(16.dp)
) {
    items(
        items = listItems.value,
        key = { it.type },
        itemContent = { item ->
            val label = when (item) {
                is BrowseEventsFilter.PeriodFilter -> {
                    when {
                        item.period.value != Period.Any -> {
                            item.enabled.value = ChipStatus.ENABLED
                            stringResource(id = item.period.value.label())
                        }


...............etc
s
It actually /is/ inside composable, but even if it wasn't, I don't see a problem with using state like that. What's the warning that you see? You might cause an extra recomposition, but this code looks correct to me.
o
yes it is inside a Composable of course, i misunderstood, should not be called within composition
whatever that means
s
Ah, it is a state flow I guess the lint here warns against using state flow value directly, as its change doesn't update composition You can try something like .collectAsState
o
hmmm
on all of them
combine collect as state
and then inside all the changes
for reference, it will become like this
Copy code
when {
    item.period.collectAsState().value