🛠️ Fix no books can be added

* Fixed issue, where you can deselect item faster than open add dialog, resulting in empty list
This commit is contained in:
Acclorite 2024-09-24 18:55:57 +03:00
parent 0a3adf42f0
commit 1b0996b135

View file

@ -439,6 +439,15 @@ class BrowseViewModel @Inject constructor(
val books = mutableListOf<NullableBook>()
_state.value.selectableFiles
.filter { it.isSelected && !it.isDirectory }
.ifEmpty {
_state.update {
it.copy(
isBooksLoading = false,
showAddingDialog = false
)
}
return@launch
}
.map { it.fileOrDirectory }
.forEach {
yield()