From eea966a6ae3a2e900d9d1386c28b0056a8032296 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Tue, 9 Jun 2020 06:22:00 +0100 Subject: [PATCH] code review: add listner once --- .../userInterface/AppPreview/CurrentItemPreview.svelte | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte b/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte index 538e8c0769..53450c2200 100644 --- a/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte +++ b/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte @@ -110,11 +110,8 @@ frontendDefinition, })) } - let iframeLoaded = false - $: if(iframe && !iframeLoaded) { - iframe.contentWindow.addEventListener("bb-ready", refreshContent) - iframeLoaded = true - } + + $: if(iframe) iframe.contentWindow.addEventListener("bb-ready", refreshContent, { once: true }) $: if(iframe && frontendDefinition) { refreshContent()