1
0
Fork 0
mirror of synced 2024-09-30 09:07:25 +13:00

Fix iframe preview loading bug in old client library versions

This commit is contained in:
Andrew Kingston 2021-07-07 13:09:33 +01:00
parent 330fd8b922
commit ef88c740b2
2 changed files with 13 additions and 2 deletions

View file

@ -73,7 +73,17 @@
// Initialise the app when mounted
iframe.contentWindow.addEventListener(
"ready",
() => refreshContent(strippedJson),
() => {
loading = false
refreshContent(strippedJson)
},
{ once: true }
)
// Use iframe loading event to support old client versions
iframe.contentWindow.addEventListener(
"iframe-loaded",
() => (loading = false),
{ once: true }
)
@ -98,7 +108,7 @@
idToDelete = data.id
confirmDeleteDialog.show()
} else if (type === "preview-loaded") {
loading = false
// loading = false
} else {
console.warning(`Client sent unknown event type: ${type}`)
}

View file

@ -64,6 +64,7 @@ export default `
if (window.loadBudibase) {
window.loadBudibase()
document.documentElement.classList.add("loaded")
window.dispatchEvent(new Event("iframe-loaded"))
} else {
throw "The client library couldn't be loaded"
}