Skip to content

Commit ab9dbe0

Browse files
nfebebackportbot[bot]
authored andcommitted
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 <[email protected]>
1 parent 6a55819 commit ab9dbe0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/src/components/UnifiedSearch/UnifiedSearchModal.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,11 @@ export default defineComponent({
507507
// If load more result for filter, remove other filters
508508
this.filters = this.filters.filter(filter => filter.id === provider.id)
509509
this.filteredProviders = this.filteredProviders.filter(filteredProvider => filteredProvider.id === provider.id)
510+
// Plugin filters may have extra parameters, so we need to keep them
511+
// See method handlePluginFilter for more details
512+
if (this.filteredProviders.length > 0 && this.filteredProviders[0].isPluginFilter) {
513+
provider = this.filteredProviders[0]
514+
}
510515
this.addProviderFilter(provider, true)
511516
},
512517
addProviderFilter(providerFilter, loadMoreResultsForProvider = false) {
@@ -531,13 +536,8 @@ export default defineComponent({
531536
this.filters = this.syncProviderFilters(this.filters, this.filteredProviders)
532537
}
533538
this.filteredProviders.push({
534-
id: providerFilter.id,
535-
appId: providerFilter.appId,
536-
searchFrom: providerFilter.searchFrom,
537-
name: providerFilter.name,
538-
icon: providerFilter.icon,
539+
...providerFilter,
539540
type: providerFilter.type || 'provider',
540-
filters: providerFilter.filters,
541541
isPluginFilter: providerFilter.isPluginFilter || false,
542542
})
543543
this.filters = this.syncProviderFilters(this.filters, this.filteredProviders)

0 commit comments

Comments
 (0)