Skip to content

Commit

Permalink
Merge pull request #50241 from nextcloud/perf/noid/unified-search-init
Browse files Browse the repository at this point in the history
  • Loading branch information
Antreesy authored Jan 18, 2025
2 parents fe43dfa + 1b7be89 commit e0c1ea2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
25 changes: 13 additions & 12 deletions core/src/components/UnifiedSearch/UnifiedSearchModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ export default defineComponent({
contacts: [],
showDateRangeModal: false,
internalIsVisible: this.open,
initialized: false,
}
},

Expand Down Expand Up @@ -308,6 +309,18 @@ export default defineComponent({
// Load results when opened with already filled query
if (this.open) {
this.focusInput()
if (!this.initialized) {
Promise.all([getProviders(), getContacts({ searchTerm: '' })])
.then(([providers, contacts]) => {
this.providers = this.groupProvidersByApp([...providers, ...this.externalFilters])
this.contacts = this.mapContacts(contacts)
unifiedSearchLogger.debug('Search providers and contacts initialized:', { providers: this.providers, contacts: this.contacts })
this.initialized = true
})
.catch((error) => {
unifiedSearchLogger.error(error)
})
}
if (this.searchQuery) {
this.find(this.searchQuery)
}
Expand All @@ -324,18 +337,6 @@ export default defineComponent({

mounted() {
subscribe('nextcloud:unified-search:add-filter', this.handlePluginFilter)
getProviders().then((providers) => {
this.providers = providers
this.externalFilters.forEach(filter => {
this.providers.push(filter)
})
this.providers = this.groupProvidersByApp(this.providers)
unifiedSearchLogger.debug('Search providers', { providers: this.providers })
})
getContacts({ searchTerm: '' }).then((contacts) => {
this.contacts = this.mapContacts(contacts)
unifiedSearchLogger.debug('Contacts', { contacts: this.contacts })
})
},
methods: {
/**
Expand Down
4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-unified-search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-unified-search.js.map

Large diffs are not rendered by default.

0 comments on commit e0c1ea2

Please sign in to comment.