Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] fix(UnifiedSearch): request data only when opening modal #50253

Merged
merged 2 commits into from
Jan 18, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading