fix: fix state issues when switching from run -> stop etc
This commit is contained in:
parent
c6b739e511
commit
75995e8985
1 changed files with 4 additions and 6 deletions
|
|
@ -85,8 +85,8 @@ class BanksiaViewModel : ViewModel() {
|
|||
when (event) {
|
||||
is BanksiaEvent.DismissState -> dismissState()
|
||||
is BanksiaEvent.SelectRoute -> state = InternalState(route = event.id)
|
||||
is BanksiaEvent.SelectRun -> state = state.copy(run = event.ref)
|
||||
is BanksiaEvent.SelectStop -> state = state.copy(stop = event.typeAndId)
|
||||
is BanksiaEvent.SelectRun -> state = state.copy(run = event.ref, stop = null)
|
||||
is BanksiaEvent.SelectStop -> state = state.copy(stop = event.typeAndId, run = null)
|
||||
is BanksiaEvent.SearchUpdate -> searchUpdate(event.text)
|
||||
}
|
||||
}
|
||||
|
|
@ -112,10 +112,8 @@ class BanksiaViewModel : ViewModel() {
|
|||
}
|
||||
|
||||
private fun dismissState() {
|
||||
viewModelScope.launch {
|
||||
switchRoute(null)
|
||||
searchUpdate("")
|
||||
}
|
||||
state = InternalState()
|
||||
viewModelScope.launch { searchUpdate("") }
|
||||
}
|
||||
|
||||
private suspend fun searchUpdate(text: String) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue