From ac99f7a23bafb00978f191d0978bed0ea295ec10 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 7 Jul 2021 13:21:30 +0100 Subject: [PATCH] Update develop with master bugfix and add comments to explain loading events --- .../design/AppPreview/CurrentItemPreview.svelte | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte b/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte index 32a5a96841..3e4789a31d 100644 --- a/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte +++ b/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte @@ -74,14 +74,11 @@ // Initialise the app when mounted iframe.contentWindow.addEventListener( "ready", - () => { - loading = false - refreshContent(strippedJson) - }, + () => refreshContent(strippedJson), { once: true } ) - // Use iframe loading event to support old client versions + // Display the client app once the iframe is initialised iframe.contentWindow.addEventListener( "iframe-loaded", () => (loading = false), @@ -109,7 +106,11 @@ idToDelete = data.id confirmDeleteDialog.show() } else if (type === "preview-loaded") { - // loading = false + // We can use this in future to delay displaying the preview + // until the client app has actually initialised. + // This makes a smoother loading experience, but is not backwards + // compatible with old client library versions. + // So do nothing with this for now. } else { console.warning(`Client sent unknown event type: ${type}`) }