Skip to content

Commit

Permalink
Fritz2 Rework
Browse files Browse the repository at this point in the history
Search clear fix
  • Loading branch information
mpetuska committed Mar 8, 2021
1 parent d3fb093 commit 407a9b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/src/jsMain/kotlin/app/store/thunk/appThunk.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.kodein.di.*


fun fetchLibraryPage(page: Int, size: Int = 12, search: String? = null, targets: Set<String>? = null) = LibraryStore.handle { state ->
val theSearch = search ?: state.search
val theSearch = (search ?: state.search)?.takeIf(String::isNotEmpty)
val theTargets = targets ?: state.targets

val service by di.instance<LibraryService>()
Expand All @@ -22,7 +22,7 @@ fun fetchLibraryPage(page: Int, size: Int = 12, search: String? = null, targets:
}

fun fetchLibraryCount(search: String? = null, targets: Set<String>? = null) = LibraryStore.handle { state ->
val theSearch = search ?: state.search
val theSearch = (search ?: state.search)?.takeIf(String::isNotEmpty)
val theTargets = targets ?: state.targets

val service by di.instance<LibraryService>()
Expand Down
4 changes: 2 additions & 2 deletions app/src/jsMain/kotlin/app/view/Header.kt
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ private fun RenderContext.SearchModal() = modal({
}.map {}.onEach {
fetchLibraryPage(
page = 1,
search = searchStore.current.takeIf(String::isNotEmpty),
search = searchStore.current,
targets = targetsStore.current.takeIf(Set<String>::isNotEmpty)
)()
fetchLibraryCount(
search = searchStore.current.takeIf(String::isNotEmpty),
search = searchStore.current,
targets = targetsStore.current.takeIf(Set<String>::isNotEmpty)
)()
} handledBy close
Expand Down

0 comments on commit 407a9b5

Please sign in to comment.