From 8c1730f579fcc1509420456b58c87897e3239d04 Mon Sep 17 00:00:00 2001 From: nfebe Date: Fri, 31 Jan 2025 14:45:29 +0100 Subject: [PATCH] fix(unified-search): filteredProviders now inherits all provider props The main providers come from both the backend and client side plugins such as `in-folder` search. The main providers may carry callbacks functions and other information that should be passed to the `filteredProviders`. This is important because the current code does not make a distinction between `filteredProviders` and `providers` rightly so, becuase they are the same thing! Without the mentioned distinction above, sooner or later, we try to access a property on the `filteredProviders` which we did not transfer with the manual property copy. ---- This fix prevents in-folder search from searching everywhere when "load more results" is clicked; Essentially ignoring the in-folder search filter. Signed-off-by: nfebe --- .../components/UnifiedSearch/UnifiedSearchModal.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/components/UnifiedSearch/UnifiedSearchModal.vue b/core/src/components/UnifiedSearch/UnifiedSearchModal.vue index 08c3657ce7819..74a17694cea73 100644 --- a/core/src/components/UnifiedSearch/UnifiedSearchModal.vue +++ b/core/src/components/UnifiedSearch/UnifiedSearchModal.vue @@ -507,6 +507,11 @@ export default defineComponent({ // If load more result for filter, remove other filters this.filters = this.filters.filter(filter => filter.id === provider.id) this.filteredProviders = this.filteredProviders.filter(filteredProvider => filteredProvider.id === provider.id) + // Plugin filters may have extra parameters, so we need to keep them + // See method handlePluginFilter for more details + if (this.filteredProviders.length > 0 && this.filteredProviders[0].isPluginFilter) { + provider = this.filteredProviders[0] + } this.addProviderFilter(provider, true) }, addProviderFilter(providerFilter, loadMoreResultsForProvider = false) { @@ -531,13 +536,8 @@ export default defineComponent({ this.filters = this.syncProviderFilters(this.filters, this.filteredProviders) } this.filteredProviders.push({ - id: providerFilter.id, - appId: providerFilter.appId, - searchFrom: providerFilter.searchFrom, - name: providerFilter.name, - icon: providerFilter.icon, + ...providerFilter, type: providerFilter.type || 'provider', - filters: providerFilter.filters, isPluginFilter: providerFilter.isPluginFilter || false, }) this.filters = this.syncProviderFilters(this.filters, this.filteredProviders)