Yann Badoual
09/26/2020, 8:11 PMState
considered Stable
because any changes will cause a recomposition? (If not then why?)Adam Powell
09/26/2020, 8:15 PMYann Badoual
09/26/2020, 8:29 PM1) The result of [equals] will always return the same result for the same two instances.Isn't this line ambiguous though? Since
value
is mutable in MutableState
,
if you change the value between two equals, wouldn't the result differ?
var value1 by mutableStateOf(0)
var value2 by mutableStateOf(0)
value1 == value2 // true
value1 = 1
value1 == value2 // false
Feels like the description is not clear enough, or maybe I'm missing something.
"for the same two instances"should be more precise maybe
Adam Powell
09/26/2020, 8:48 PMequals
on the @Stable
object instances, not on .value
Adam Powell
09/26/2020, 8:50 PMvar state1 = mutableStateOf(0)
var state2 = mutableStateOf(0)
state1 == state2 // false
state1.value = 1
state1 == state2 // false
Adam Powell
09/26/2020, 8:50 PM.equals
for the stability contractYann Badoual
09/26/2020, 9:02 PMState
.equals
implementation was comparing values. Ok that makes sense now. Thanks!