when composing for the first time only. Subsequent compositions will just return the remembered items (until the composable is removed from composition, in which case its remembered state is also removed from from composition/memory)
r
Radoslaw Juszczyk
01/15/2024, 5:46 PM
Yes, what I want is it to not run
update items calculation
when composing for the first time
e
efemoney
01/17/2024, 2:54 PM
Put it behind a boolean?
currentComposer.inserting
or something, although <-- that is not recommended. You can also maintain state in composition that is updated from the side effect
efemoney
01/17/2024, 2:56 PM
Copy code
val abc by remember { mSO(false) }
SideEffect {
if (!abc) abc = true else update items
}