fix(search): avoid restarting completed search
This commit is contained in:
@@ -542,6 +542,7 @@ class SearchViewModel(
|
|||||||
} catch (exception: CancellationException) {
|
} catch (exception: CancellationException) {
|
||||||
throw exception
|
throw exception
|
||||||
} catch (exception: Throwable) {
|
} catch (exception: Throwable) {
|
||||||
|
wasSearching = false
|
||||||
_uiState.update { it.copy(isSearching = false) }
|
_uiState.update { it.copy(isSearching = false) }
|
||||||
exception.localizedMessage
|
exception.localizedMessage
|
||||||
?.takeIf { it.isNotBlank() }
|
?.takeIf { it.isNotBlank() }
|
||||||
@@ -571,6 +572,7 @@ class SearchViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
is SearchRunEvent.Finished -> {
|
is SearchRunEvent.Finished -> {
|
||||||
|
wasSearching = false
|
||||||
_uiState.update { state ->
|
_uiState.update { state ->
|
||||||
val emptyAction = if (searchResultBooks.isEmpty() && event.isEmpty && !searchScope.isAll()) {
|
val emptyAction = if (searchResultBooks.isEmpty() && event.isEmpty && !searchScope.isAll()) {
|
||||||
SearchEmptyScopeAction(
|
SearchEmptyScopeAction(
|
||||||
|
|||||||
Reference in New Issue
Block a user