Skip to content

Commit 8cc222e

Browse files
author
MMelchor
committed
fix: [257] unnecessary repetitive requests using the search bar
Assigning the search query value to the variable used to fetch the searched torrents is now done through the onActivated hook, avoiding triggering the watchers, and thus, not making another unnecessary fetch request to the back-end, getting the torrents only once.
1 parent 67a7bcd commit 8cc222e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pages/torrents.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,11 @@ watch([searchQuery, itemsSorting, pageSize, currentPage, layout, categoryFilters
126126
loadTorrents();
127127
});
128128
129-
onMounted(() => {
129+
onActivated(() => {
130130
searchQuery.value = route.query.search as string ?? null;
131+
});
132+
133+
onMounted(() => {
131134
loadTorrents();
132135
});
133136

0 commit comments

Comments
 (0)