mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 08:45:27 +02:00
Fixed unit list loading
This commit is contained in:
parent
72f6d2e4f7
commit
bc55e23e04
@ -421,6 +421,9 @@ class MainViewModel @Inject constructor(
|
|||||||
leftSide: Boolean
|
leftSide: Boolean
|
||||||
) {
|
) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
|
// Prevent user from seeing invalid list
|
||||||
|
unitsToShow = emptyMap()
|
||||||
|
|
||||||
val filterGroup: Boolean = chosenUnitGroup != null
|
val filterGroup: Boolean = chosenUnitGroup != null
|
||||||
|
|
||||||
// This is mostly not UI related stuff and viewModelScope.launch uses Dispatchers.Main
|
// This is mostly not UI related stuff and viewModelScope.launch uses Dispatchers.Main
|
||||||
|
@ -105,13 +105,6 @@ fun SecondScreen(
|
|||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
/**
|
/**
|
||||||
* Telling viewModel that it needs to update the list
|
* Telling viewModel that it needs to update the list
|
||||||
* Also while the below is being computed user will composable will use cached list from viewModel
|
|
||||||
*
|
|
||||||
* User actually doesn't see cached list. Computation takes few milliseconds since we don't
|
|
||||||
* compute any Levenshtein distance when the screen is launched and the list is limited
|
|
||||||
* to a specific [UnitGroup]
|
|
||||||
*
|
|
||||||
* Adding animation/spinners will cause flickering and confuse user
|
|
||||||
*/
|
*/
|
||||||
viewModel.loadUnitsToShow(searchQuery, chosenUnitGroup, leftSide)
|
viewModel.loadUnitsToShow(searchQuery, chosenUnitGroup, leftSide)
|
||||||
// Scrolling chips to current group
|
// Scrolling chips to current group
|
||||||
|
Loading…
x
Reference in New Issue
Block a user