fix(search): avoid restarting completed search

This commit is contained in:
HapeLee
2026-07-01 23:43:15 +08:00
parent da00f712bf
commit b657e38712
@@ -542,6 +542,7 @@ class SearchViewModel(
} catch (exception: CancellationException) {
throw exception
} catch (exception: Throwable) {
wasSearching = false
_uiState.update { it.copy(isSearching = false) }
exception.localizedMessage
?.takeIf { it.isNotBlank() }
@@ -571,6 +572,7 @@ class SearchViewModel(
}
is SearchRunEvent.Finished -> {
wasSearching = false
_uiState.update { state ->
val emptyAction = if (searchResultBooks.isEmpty() && event.isEmpty && !searchScope.isAll()) {
SearchEmptyScopeAction(