Skip to content

Commit

Permalink
馃悰 Fixes iframe widget refresh (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed May 11, 2024
1 parent eea193a commit 07dbccc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/components/Widgets/IframeWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/mixins/WidgetMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},
Expand Down

0 comments on commit 07dbccc

Please sign in to comment.