Fix search exit flow and history behavior

This commit is contained in:
2026-05-23 20:33:48 +00:00
parent 0f404e5e53
commit 79dc1b25cc
2 changed files with 112 additions and 23 deletions
+1 -8
View File
@@ -93,7 +93,6 @@ const props = defineProps<{
const emit = defineEmits<{
search: [string];
clearSearch: [];
goBack: [];
}>();
@@ -126,14 +125,12 @@ const isSearchActive = computed(() => {
// Switch views on focus (no Enter required) - only in browse mode
function switchToMovies() {
if (!isDetailPage.value && props.currentView !== 'movies') {
emit('clearSearch');
router.push('/movies');
}
}
function switchToSeries() {
if (!isDetailPage.value && props.currentView !== 'series') {
emit('clearSearch');
router.push('/series');
}
}
@@ -150,11 +147,7 @@ function handleSearchFocus() {
}
// Sync local search to parent
watch(localSearch, (val, prevVal) => {
// When user starts typing from detail page, exit detail and show search results.
if (isDetailPage.value && !prevVal && !!val.trim()) {
goToCategory();
}
watch(localSearch, (val) => {
emit('search', val);
});