I was just doing some testing for one of my Composables when I found this very bizarre behaviour.
This code:-
{ //Composable-Scope
var fired = remember { false }
if(!fired) { Fire(); fired = true }
}
calls the methof Fire()
on every recomposition.
On the other hand, however,
{ //Composable Scope
var fired by remember { mutableStateOf(false) }
if(!fired) { Fire(); fired = true }
}
calls Fire()
only upon the first Composition.
If this is the intended behaviour, is there a good explanation for why remember
is not made universal? If it is not the intended behavior, I'll probably just file a bug.