Kartikey Shukla
06/13/2026, 12:01 PMviewModelScope.launch {
combine(
currentLevelManager.currentLevel,
prefRepository.userData
) { level, userData ->
level to userData.userLocation
}.collect { (level, location) ->
val currentState = _uiState.value
val shouldRefresh = currentState.postLevel != level ||
(currentState.postsFlow == null && location != null)
if (shouldRefresh || currentState.postsFlow == null) {
updateState {
it.copy(
postLevel = level,
postsFlow = feedRepository.getPagedPosts(
level,
location,
forceRefresh = false // Use cache if available
).cachedIn(viewModelScope)
)
}
observeActiveIssues(level)
}
}
}
or should I refactor the viewmodel accordingly ? What is the standard way of having native UI in KMP ?Artem Olkov
06/14/2026, 9:35 AMArtem Olkov
06/14/2026, 9:36 AM