Skip to content

Commit 4a13fc1

Browse files
committed
fix: [#692] fixed torrents results not displaying correctly when updating the page size
1 parent ccf5ef2 commit 4a13fc1

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

pages/torrents.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ watch(() => route.fullPath, () => {
128128
: (route.query.tagFilters ? [route.query.tagFilters as string] : []);
129129
});
130130
131-
watch([searchQuery, itemsSorting, pageSize, currentPage, layout, categoryFilters, tagFilters], () => {
131+
watch([searchQuery, itemsSorting, currentPage, layout, categoryFilters, tagFilters], () => {
132132
router.push({
133133
query: {
134134
search: searchQuery.value,
@@ -144,6 +144,23 @@ watch([searchQuery, itemsSorting, pageSize, currentPage, layout, categoryFilters
144144
loadTorrents();
145145
});
146146
147+
// Resets the current page value to 1 when the page size is changed to display results correctly
148+
watch(pageSize, () => {
149+
router.push({
150+
query: {
151+
search: searchQuery.value,
152+
sorting: itemsSorting.value ? itemsSorting.value : sortingOptions[0].value,
153+
pageSize: pageSize.value,
154+
page: 1,
155+
layout: layout.value,
156+
categoryFilters: categoryFilters.value.length > 0 ? categoryFilters.value : [],
157+
tagFilters: tagFilters.value.length > 0 ? tagFilters.value : []
158+
}
159+
});
160+
161+
loadTorrents();
162+
});
163+
147164
onActivated(() => {
148165
searchQuery.value = route.query.search as string ?? null;
149166
itemsSorting.value = route.query.sorting as string ?? sortingOptions[0].value;

0 commit comments

Comments
 (0)