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:
James Rich
2026-05-06 12:46:42 -05:00
parent 5dd5ebc074
commit b3542c76aa

View File

@@ -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 ->