fix(webui): prevent empty search and cancel search on modal close

- Add input validation to prevent search when keyword is empty or whitespace
- Close EventSource connection when search modal is closed to stop ongoing searches

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
EstrellaXD
2026-01-26 15:42:40 +01:00
parent bb8adf6813
commit 0ba508cd0b

View File

@@ -227,6 +227,7 @@ export const useSearchStore = defineStore('search', () => {
function closeModal() {
showModal.value = false;
selectedResult.value = null;
closeSearch();
}
function toggleModal() {
@@ -277,6 +278,13 @@ export const useSearchStore = defineStore('search', () => {
selectedResult.value = null;
}
function onSearch() {
if (!keyword.value.trim()) {
return;
}
openSearch();
}
return {
// State
inputValue: keyword,
@@ -295,7 +303,7 @@ export const useSearchStore = defineStore('search', () => {
// Actions
clearSearch,
getProviders,
onSearch: openSearch,
onSearch,
closeSearch,
openModal,
closeModal,