Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for [#247] search bar not working when in /torrents endpoint #251

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions components/navigation/NavigationBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@
import { UserCircleIcon, Bars3Icon, MagnifyingGlassIcon } from "@heroicons/vue/24/solid";
import { ChevronDownIcon } from "@heroicons/vue/20/solid";
import { Ref } from "vue";
import { useRouter } from "#app";
import { ref, useSettings, useUser, logoutUser } from "#imports";

const router = useRouter();
const settings = useSettings();
const user = useUser();

Expand All @@ -121,7 +119,7 @@ const searchQuery: Ref<string> = ref("");
const typingInSearch = ref(false);

function submitSearch () {
router.push({
navigateTo({
path: "/torrents",
query: {
search: searchQuery.value ?? null
Expand Down
6 changes: 2 additions & 4 deletions pages/torrents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,8 @@ const selectedSorting = computed({
}
});

watch([route], () => {
if (route.query.search !== searchQuery.value) {
searchQuery.value = route.query.search as string;
}
watch(() => route.fullPath, () => {
searchQuery.value = route.query.search as string;
});

watch([searchQuery, itemsSorting, pageSize, currentPage, layout, categoryFilters, tagFilters], () => {
Expand Down