From 328fe4256e706e7fa64a44c352e3654c44c98fda Mon Sep 17 00:00:00 2001 From: chfhtw Date: Tue, 14 Apr 2026 11:44:30 +0200 Subject: [PATCH] safeguard component loading from widgetTemplate (=widgetSetup) --- public/js/components/Dashboard/Item.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/public/js/components/Dashboard/Item.js b/public/js/components/Dashboard/Item.js index 94ee0bbef..00951cdd5 100644 --- a/public/js/components/Dashboard/Item.js +++ b/public/js/components/Dashboard/Item.js @@ -158,6 +158,20 @@ export default { } } this.$emit("change", config); + }, + async initializeComponent() { + if ( + this.widgetTemplate + && this.widgetTemplate.setup + && this.widgetTemplate.widget_id + && this.widgetTemplate.arguments + ) { + let component = (await import(this.widgetTemplate.setup.file)).default; + this.$options.components["widget" + this.widgetTemplate.widget_id] = component; + this.component = "widget" + this.widgetTemplate.widget_id; + this.arguments = { ...this.widgetTemplate.arguments, ...this.config }; + this.tmpConfig = { ...this.arguments }; + } } }, watch: { @@ -167,13 +181,12 @@ export default { this.$refs.config && this.$refs.config.hide(); this.isLoading = false; }, + widgetTemplate() { + this.initializeComponent(); + } }, - async created() { - let component = (await import(this.widgetTemplate.setup.file)).default; - this.$options.components["widget" + this.widgetTemplate.widget_id] = component; - this.component = "widget" + this.widgetTemplate.widget_id; - this.arguments = { ...this.widgetTemplate.arguments, ...this.config }; - this.tmpConfig = { ...this.arguments }; + created() { + this.initializeComponent(); }, template: /*html*/ `