mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-13 18:11:03 +08:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user