From 07dbcccc8371c332ad4af97c42dfc82b926eef48 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 11 May 2024 15:26:32 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixes=20iframe=20widget=20refres?= =?UTF-8?q?h=20=20(#1571)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Widgets/IframeWidget.vue | 13 +++++++++++-- src/mixins/WidgetMixin.js | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/Widgets/IframeWidget.vue b/src/components/Widgets/IframeWidget.vue index 5c5f7b71..656b893e 100644 --- a/src/components/Widgets/IframeWidget.vue +++ b/src/components/Widgets/IframeWidget.vue @@ -45,8 +45,17 @@ export default { /* Refreshes iframe contents, called by parent */ update() { this.startLoading(); - this.updateCount += 1; - (document.getElementById(this.frameId) || {}).src = this.frameUrl; + const iframe = document.getElementById(this.frameId); + if (iframe.contentWindow) { + try { + iframe.contentWindow.location.href = this.frameUrl; + iframe.contentWindow.location.reload(true); + } catch (e) { + this.error('Failed to refresh iframe', e, true); + } + } else { + this.error('Couldn\'t find iframe', null, true); + } this.finishLoading(); }, }, diff --git a/src/mixins/WidgetMixin.js b/src/mixins/WidgetMixin.js index 53019adf..a497dafb 100644 --- a/src/mixins/WidgetMixin.js +++ b/src/mixins/WidgetMixin.js @@ -72,9 +72,9 @@ const WidgetMixin = { this.updater = setInterval(() => { this.update(); }, this.updateInterval); }, /* Called when an error occurs. Logs to handler, and passes to parent component */ - error(msg, stackTrace) { + error(msg, stackTrace, quite = false) { ErrorHandler(msg, stackTrace); - if (!this.options.ignoreErrors) { + if (!this.options.ignoreErrors && !quite) { this.$emit('error', msg); } },