Skip to content

Commit 67a7bcd

Browse files
committed
Merge #251: Fix for [#247] search bar not working when in /torrents endpoint
6c72733 refactor: [#247] search bar not working when in /torrents endpoint (MMelchor) e4d5fcd fix: [#247] search bar not working when in /torrents endpoint (MMelchor) Pull request description: Fixes #247 The search bar was not working when in the /torrents endpoint, because the watcher listening for changes in the url path was not triggering when the user searches for a specific torrent. ACKs for top commit: josecelano: ACK 6c72733 Tree-SHA512: 07fb67da678f06c0b550716bb06c146e41d788b445375ad0fe1c818dcb1c68d8a53fac6d5b33361b39ac53a80aa1b01f6bd3d8310cf97e706c62f14f3ac9228d
2 parents 1e7dc8b + 6c72733 commit 67a7bcd

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

components/navigation/NavigationBar.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,8 @@
109109
import { UserCircleIcon, Bars3Icon, MagnifyingGlassIcon } from "@heroicons/vue/24/solid";
110110
import { ChevronDownIcon } from "@heroicons/vue/20/solid";
111111
import { Ref } from "vue";
112-
import { useRouter } from "#app";
113112
import { ref, useSettings, useUser, logoutUser } from "#imports";
114113
115-
const router = useRouter();
116114
const settings = useSettings();
117115
const user = useUser();
118116
@@ -121,7 +119,7 @@ const searchQuery: Ref<string> = ref("");
121119
const typingInSearch = ref(false);
122120
123121
function submitSearch () {
124-
router.push({
122+
navigateTo({
125123
path: "/torrents",
126124
query: {
127125
search: searchQuery.value ?? null

pages/torrents.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,8 @@ const selectedSorting = computed({
106106
}
107107
});
108108
109-
watch([route], () => {
110-
if (route.query.search !== searchQuery.value) {
111-
searchQuery.value = route.query.search as string;
112-
}
109+
watch(() => route.fullPath, () => {
110+
searchQuery.value = route.query.search as string;
113111
});
114112
115113
watch([searchQuery, itemsSorting, pageSize, currentPage, layout, categoryFilters, tagFilters], () => {

0 commit comments

Comments
 (0)