Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
na...@google.com <na...@google.com> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
Description
Currently, when using
SavedStateHandle
APIs such asget(key): T
,getLiveData(key): MutableLiveData
, andgetStateFlow(key): StateFlow
simultaneously with a matchingkey
, theSavedStateHandle
synchronizes the value between them.However, synchronizing between a
MutableStateFlow
and aMutableLiveData
would be very challenging, and now thatSavedStateHandle
is Multiplatform,MutableLiveData
is not available in Kotlin Multiplatform.For this reason, we have decided to:
getMutableStateFlow(key): MutableStateFlow
.getMutableStateFlow(key): MutableStateFlow
and agetLiveData(key): MutableLiveData
mutually exclusive.Therefore, once a
key
is used by one of the two methods, attempting to get the other with the same key will result in an exception.Please note that
getStateFlow(key): StateFlow
will remain unchanged and is not mutually exclusive withgetLiveData(key): MutableLiveData
to maintain backward compatibility.These changes will also address the following feature requests: b/354497131 and b/235574686