only reset bestMatch when searchquery is empty

This commit is contained in:
Sir-Photch 2023-10-28 13:56:48 +02:00
parent aa0447de7a
commit 9f6f17b9b7
2 changed files with 5 additions and 3 deletions

View File

@ -13,7 +13,7 @@ android {
} }
packaging { packaging {
resources.excludes.add("META-INF/DEPENDENCIES") //resources.excludes.add("META-INF/DEPENDENCIES")
resources.excludes.add("META-INF/LICENSE") resources.excludes.add("META-INF/LICENSE")
resources.excludes.add("META-INF/LICENSE.txt") resources.excludes.add("META-INF/LICENSE.txt")
resources.excludes.add("META-INF/license.txt") resources.excludes.add("META-INF/license.txt")
@ -168,4 +168,4 @@ dependencies {
// Uncomment this if you want annoying notifications in your debug builds yelling at you how terrible your code is // Uncomment this if you want annoying notifications in your debug builds yelling at you how terrible your code is
//debugImplementation(libs.leakcanary) //debugImplementation(libs.leakcanary)
} }

View File

@ -104,7 +104,9 @@ class SearchVM : ViewModel(), KoinComponent {
searchQuery.value = query searchQuery.value = query
isSearchEmpty.value = query.isEmpty() isSearchEmpty.value = query.isEmpty()
hiddenResults.value = emptyList() hiddenResults.value = emptyList()
bestMatch.value = null
if (isSearchEmpty.value)
bestMatch.value = null
try { try {
searchJob?.cancel() searchJob?.cancel()