mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-12 08:42:01 -04:00
fix: remove circular StateFlow observation in RadioConfigViewModel
The combine(serviceRepository.connectionState, radioConfigState) pattern subscribed to the ViewModel's own output StateFlow, causing redundant re-evaluations on every state change. Replace with direct observation of the source connectionState flow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -235,9 +235,10 @@ open class RadioConfigViewModel(
|
||||
.onEach { manifest -> _radioConfigState.update { it.copy(fileManifest = manifest) } }
|
||||
.launchIn(viewModelScope)
|
||||
|
||||
combine(serviceRepository.connectionState, radioConfigState) { connState, _ ->
|
||||
_radioConfigState.update { it.copy(connected = connState == ConnectionState.Connected) }
|
||||
}
|
||||
serviceRepository.connectionState
|
||||
.onEach { connState ->
|
||||
_radioConfigState.update { it.copy(connected = connState == ConnectionState.Connected) }
|
||||
}
|
||||
.launchIn(viewModelScope)
|
||||
|
||||
combine(nodeRepository.myNodeInfo, destNumFlow) { ni, id ->
|
||||
|
||||
Reference in New Issue
Block a user