deviant
08/03/2022, 8:25 AMderivedStateOf
should be always wrapped into remember
, i decided to make this helper
@Composable
fun <T> rememberDerived(calculation: () -> T) = remember {
derivedStateOf(calculation)
}
do you see any issues with it?Stylianos Gakis
08/03/2022, 1:07 PMremember
your derivedStateOf
calls. I don’t know about the function above though, if compose can still do proper tracking of what is read inside the derivedStateOf
to only recompose when it needs to. For one maybe this function is introducing a new recomposition scope? How does it work if you make it inline, does it do what you expect? Just a wild guess though.
I’d personally go for simple remember { derivedStateOf {} }
since sometimes you do want to pass some things as keys to the remember
function if they’re not state objects. Since derivedStateOf
only knows how to read and automatically keep up to date with state objects, not anything you put in there.FunkyMuse
08/03/2022, 4:32 PMStylianos Gakis
08/03/2022, 5:05 PMshikasd
08/03/2022, 5:17 PMSean McQuillan [G]
08/03/2022, 10:55 PMdeviant
08/04/2022, 9:00 AMkey
param to pass into remember
. the bug i observe is coming from somewhere else. and i can't reproduce it on hello world project (my widget isn't being updated despite the recomposition is being triggered). will file a bug when have an evidences