i have an UI for assigning a UserRole. the list of...
# compose
c
i have an UI for assigning a UserRole. the list of user roles is queried from the DB (flow) and exposed as a uiState in the ViewModel. the selected role is a mutable state
Copy code
private var currentRoleSelection = mutableStateOf<UserRole>(null)
i want to have a initial selection for
currentRoleSelection
(let's say the first role in the list) but i have to wait for the userRoles to be queried from the DB
Copy code
val uiState: StateFlow<UiState> = combine(   
   userRoles, // Flow<UserRole>
//other flows,
   snapshotFlow { currentRole }
) { ... -> }
how would i set the mutableState once the DB roles are queried? do i need to "convert" that userRoles to a state as well in order to use sth like
derivedStateOf{}
?