Alex
07/13/2022, 12:26 PMMutableState in this way:
var result by mutableStateOf<R?>(value = null, policy = neverEqualPolicy())
Now I am setting an object via result = TheObject
I am listening to that via
LaunchedEffect(Unit) {
snapshotFlow { result }.collectLatest {
(logging here)
}
}
But I am only receiving a log when the first object is set, all subsequent value changes with TheObject on result are not logged. Shouldn’t neverEqualPolicy() ensure that every value change is emitted? What am I missing here?Stylianos Gakis
07/13/2022, 2:34 PMsnapshotFlow itself seems to be doing a .equals check of its own to know whether to emit or not, despite whatever equality policy you’ve setup to the mutableState itself. At least that’s my interpretation of the docs hereStylianos Gakis
07/13/2022, 2:35 PMAlex
07/14/2022, 7:12 AMAlex
07/14/2022, 7:13 AMpolicy on snapshotFlow too. I guess that would be a feature request then.Stylianos Gakis
07/14/2022, 7:15 AMAlex
07/14/2022, 7:22 AM!= anything else and pass the check in snapshotFlow then unwrapping it for the collector, maybe I can create a top level method for this without copying snapshotFlowStylianos Gakis
07/14/2022, 7:26 AMZach Klippenstein (he/him) [MOD]
07/14/2022, 4:48 PMAlex
07/14/2022, 6:28 PMZach Klippenstein (he/him) [MOD]
07/14/2022, 9:09 PMAlex
07/15/2022, 8:52 AMStylianos Gakis
07/15/2022, 9:01 AMAlex
07/15/2022, 9:02 AM