From 4e1d3209df35a5de21cbf62f467b9efc2c1cb23d Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Wed, 20 Aug 2025 12:05:44 +0200 Subject: [PATCH] Don't request summaries in ProjectList. Those will be populated directly by Vuex. --- .../client/source/src/views/ProjectList.vue | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/lib/www/client/source/src/views/ProjectList.vue b/lib/www/client/source/src/views/ProjectList.vue index 3062ffc..a8a4b3e 100644 --- a/lib/www/client/source/src/views/ProjectList.vue +++ b/lib/www/client/source/src/views/ProjectList.vue @@ -189,19 +189,20 @@ export default { ...mapGetters(['loading', 'projects']) }, + watch: { + + async projects () { + await this.load(); + } + + }, + methods: { async list () { this.items = [...this.projects]; }, - async summary (item) { - const details = await this.api([`/project/${item.pid}/summary`]); - if (details) { - return Object.assign({}, details, item); - } - }, - title (item) { if (item.organisations) { return "Access:\n" + Object.entries(item.organisations).map( org => @@ -212,30 +213,22 @@ export default { }, async load () { - await this.refreshProjects(); + if (!this.projects.length) { + this.refreshProjects(); + } await this.list(); - const promises = []; - for (const key in this.items) { - const item = this.items[key]; - const promise = this.summary(item) - .then( expanded => { - if (expanded) { - this.$set(this.items, key, expanded); - } - }); - promises.push(promise); + }, + + handlerLoad (context, {payload}) { + if (payload?.table == "public") { + this.load(); } }, registerNotificationHandlers () { this.$store.dispatch('registerHandler', { table: 'project`', - - handler: (context, message) => { - if (message.payload?.table == "public") { - this.load(); - } - } + handler: this.handlerLoad }); },