Skip to content
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
Next Next commit
perf: Load taskprocessing tasks only once showing the menu
Signed-off-by: Julius Knorr <[email protected]>
  • Loading branch information
juliusknorr authored and backportbot[bot] committed Nov 25, 2025
commit 41b62ea515760f9e9d75819cf3648c979505cd16
18 changes: 15 additions & 3 deletions src/components/Menu/AssistantAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
close-after-click
@click="showTaskList = true">
<template #icon>
<NcAssistantIcon :size="20" class="assistant-icon" />
<NcLoadingIcon v-if="loading" :size="20" />
<NcAssistantIcon v-else :size="20" class="assistant-icon" />
</template>
{{ t('text', 'Show assistant results') }}
</NcActionButton>
Expand Down Expand Up @@ -161,6 +162,7 @@ import NcActions from '@nextcloud/vue/components/NcActions'
import NcActionSeparator from '@nextcloud/vue/components/NcActionSeparator'
import NcAssistantIcon from '@nextcloud/vue/components/NcAssistantIcon'
import NcListItem from '@nextcloud/vue/components/NcListItem'
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
import NcModal from '@nextcloud/vue/components/NcModal'
import ErrorOutlineIcon from 'vue-material-design-icons/AlertCircleOutline.vue'
import CheckCircleOutlineIcon from 'vue-material-design-icons/CheckCircleOutline.vue'
Expand Down Expand Up @@ -206,6 +208,7 @@ export default {
NcActionButton,
NcActionSeparator,
NcListItem,
NcLoadingIcon,
NcModal,
},
extends: BaseActionEntry,
Expand All @@ -217,9 +220,10 @@ export default {
data() {
return {
menuOpen: false,
taskTypes: OCP.InitialState.loadState('text', 'taskprocessing'),
taskTypes: loadState('text', 'taskprocessing', []),
selection: '',
tasks: [],
loading: false,

STATUS_FAILED,
STATUS_RUNNING,
Expand Down Expand Up @@ -262,9 +266,17 @@ export default {
return this.taskTypes.map((type) => type.id)
},
},
watch: {
async menuOpen(isOpen) {
if (isOpen && this.tasks.length === 0) {
this.loading = true
await this.fetchTasks()
this.loading = false
}
},
},
beforeMount() {
this.editor.on('selectionUpdate', this.onSelection)
this.fetchTasks()
subscribe('notifications:notification:received', this.checkNotification)
},
beforeDestroy() {
Expand Down