Is `flatMapLatest` supposed to work correctly with...
# coroutines
m
Is
flatMapLatest
supposed to work correctly with
StateFlow
? In the following code:
Copy code
val locallyAvailableProjectIdsFlow = storageFlow.flatMapLatest {
    it?.projectEntityPackageStorage?.projectIdsFlow
        ?: emptyFlow<WatchState<List<ProjectId>>>().asStateFlow(WatchState.Idle())
}
storageFlow
and
projectIdsFlow
are `StateFlow`s, but
locallyAvailableProjectIdsFlow
is not being updated.
asStateFlow
is defined as:
Copy code
private fun <T> Flow<T>.asStateFlow(initialValue: T) =
    stateIn(coroutineScope, SharingStarted.Eagerly, initialValue)
Am I doing anything wrong?
Yes, they work together. I made a semplified version of the same code and it works. There must be a problem somewhere.