Skip to content

Commit

Permalink
fix: [#600] going back in torrent list after filtering with one tag
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Aug 6, 2024
1 parent fdabd00 commit cc1b5e4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pages/torrents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ const selectedSorting = computed({
watch(() => route.fullPath, () => {
searchQuery.value = route.query.search as string ?? null;
itemsSorting.value = route.query.sorting as string ?? null;
pageSize.value = isNaN(route.query.pageSize) ? parseInt(route.query.pageSize) : defaultPageSize;
currentPage.value = isNaN(route.query.page) ? parseInt(route.query.page) : 1;
layout.value = route.query.layout as string ?? null;
itemsSorting.value = route.query.sorting as string ?? sortingOptions[0].value;
pageSize.value = isNaN(route.query.pageSize) ? defaultPageSize : parseInt(route.query.pageSize);
currentPage.value = isNaN(route.query.page) ? 1 : parseInt(route.query.page);
layout.value = route.query.layout as string ?? "default";
// Ensure categoryFilters is always an array of strings
categoryFilters.value = Array.isArray(route.query.categoryFilters)
Expand All @@ -132,7 +132,7 @@ watch([searchQuery, itemsSorting, pageSize, currentPage, layout, categoryFilters
router.push({
query: {
search: searchQuery.value,
sorting: itemsSorting.value,
sorting: itemsSorting.value ? itemsSorting.value : sortingOptions[0].value,
pageSize: pageSize.value,
page: currentPage.value,
layout: layout.value,
Expand All @@ -146,10 +146,10 @@ watch([searchQuery, itemsSorting, pageSize, currentPage, layout, categoryFilters
onActivated(() => {
searchQuery.value = route.query.search as string ?? null;
itemsSorting.value = route.query.sorting as string ?? null;
itemsSorting.value = route.query.sorting as string ?? sortingOptions[0].value;
pageSize.value = route.query.pageSize as number ?? defaultPageSize;
currentPage.value = route.query.page as number ?? 1;
layout.value = route.query.layout as string ?? null;
layout.value = route.query.layout as string ?? "default";
categoryFilters.value = route.query.categoryFilters as string[] ?? null;
tagFilters.value = route.query.tagFilters as string[] ?? null;
});
Expand Down

0 comments on commit cc1b5e4

Please sign in to comment.