Interests: used filterIsInstance to find the TopicNavKey and get its ID instead of explicit type check and cast approach.

pull/2028/head
junior-od 3 days ago
parent 788672e29b
commit 31446c8e6c

@ -48,8 +48,9 @@ class InterestsViewModel @AssistedInject constructor(
private val selectedTopicId: StateFlow<String?> =
snapshotFlow {
navigationState.currentSubStack
.lastOrNull { it is TopicNavKey }
?.let { (it as TopicNavKey).id }
.filterIsInstance<TopicNavKey>()
.lastOrNull()
?.id
}.stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(5_000),

Loading…
Cancel
Save