🐛 Fixes iframe widget refresh (#1571)

This commit is contained in:
Alicia Sykes 2024-05-11 15:26:32 +01:00
parent eea193ae5c
commit 07dbcccc83
2 changed files with 13 additions and 4 deletions

View File

@ -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();
},
},

View File

@ -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);
}
},