Widget: fix loading spinner not showing on API-request (#5228)

* Widget: fix loading spinner not showing while API-request

* remove not needed showModal as it is handled be frame_loading-watcher

* add double check if dialog is open before closing it
This commit is contained in:
Richard Schreiber
2025-06-10 20:35:11 +02:00
committed by GitHub
parent d53af424cf
commit b75f8bf893

View File

@@ -2182,11 +2182,22 @@ var create_overlay = function (app) {
// show loading spinner only when previously no frame_src was set
if (newValue && !oldValue) {
this.frame_loading = true;
this.$el?.querySelector('dialog.pretix-widget-frame-holder').showModal();
}
// to close and unload the iframe, frame_src can be empty -> make it valid HTML with about:blank
this.$el.querySelector("iframe").src = newValue || "about:blank";
},
frame_loading: function (newValue) {
var dialog = this.$el?.querySelector('dialog.pretix-widget-frame-holder');
if (newValue) {
if (!dialog.open) {
dialog.showModal();
}
} else {
if (!this.frame_src && dialog.open) {// finished loading, but no iframe to display => close
dialog.close();
}
}
},
}
});
app.$root.overlay = framechild;