From c1d7aa494c2d158226bc73c4de3cc8498bf7c7a5 Mon Sep 17 00:00:00 2001 From: Prospector <6166773+Prospector@users.noreply.github.com> Date: Sun, 3 May 2026 12:02:09 -0700 Subject: [PATCH] fix: search page not resetting to 1 when query changes (#5983) * fix: search page not resetting to 1 when query changes * prepr --- .../composables/use-browse-search.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/ui/src/layouts/shared/browse-tab/composables/use-browse-search.ts b/packages/ui/src/layouts/shared/browse-tab/composables/use-browse-search.ts index 0f194a686..496df6107 100644 --- a/packages/ui/src/layouts/shared/browse-tab/composables/use-browse-search.ts +++ b/packages/ui/src/layouts/shared/browse-tab/composables/use-browse-search.ts @@ -180,6 +180,26 @@ export function useBrowseSearch(options: UseBrowseSearchOptions): BrowseSearchSt let searchVersion = 0 let searchDebounceTimer: ReturnType | null = null + const providedFiltersOrEmpty = computed(() => options.providedFilters?.value ?? []) + + watch( + [ + query, + maxResults, + options.projectType, + currentSortType, + serverCurrentSortType, + currentFilters, + serverCurrentFilters, + overriddenProvidedFilterTypes, + providedFiltersOrEmpty, + ], + () => { + currentPage.value = 1 + }, + { deep: true }, + ) + watch(effectiveRequestParams, (newVal, oldVal) => { debug('effectiveRequestParams changed', { from: oldVal?.substring(0, 80),