From fb0866f0d9f902a797790d1dcd663641079ee50a Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 24 Oct 2022 09:43:45 +0100 Subject: [PATCH] Tidy up --- .../[screenId]/_components/AppPreview.svelte | 16 ++++------------ .../src/components/preview/GridDNDHandler.svelte | 7 ++++--- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte index 9cbb283fef..2b3b685dc4 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte @@ -124,6 +124,7 @@ if (!message?.data?.type) { return } + console.debug(`CLIENT: [${message.data.type}]`) // Await the event handler try { @@ -139,20 +140,11 @@ } const handleBudibaseEvent = async event => { - const { type, data } = event.data || event.detail - if (!type) { - return - } + const { type, data } = event.data if (type === MessageTypes.READY) { // Initialise the app when mounted - if ($store.clientFeatures.messagePassing) { - if (!loading) return - } - - // Display preview immediately if the intelligent loading feature - // is not supported - if (!$store.clientFeatures.intelligentLoading) { - loading = false + if (!loading) { + return } refreshContent(json) } else if (type === MessageTypes.ERROR) { diff --git a/packages/client/src/components/preview/GridDNDHandler.svelte b/packages/client/src/components/preview/GridDNDHandler.svelte index 4a95080523..335f463c08 100644 --- a/packages/client/src/components/preview/GridDNDHandler.svelte +++ b/packages/client/src/components/preview/GridDNDHandler.svelte @@ -7,10 +7,12 @@ let gridStyles let id + // Some memoisation of primitive types for performance $: jsonStyles = JSON.stringify(gridStyles) $: id = dragInfo?.id || id - $: instance = componentStore.actions.getComponentInstance(id) - $: instance?.setEphemeralStyles({ + + // Set ephemeral grid styles on the dragged component + $: componentStore.actions.getComponentInstance(id)?.setEphemeralStyles({ ...gridStyles, ...(gridStyles ? { "z-index": 999 } : null), }) @@ -193,7 +195,6 @@ // Callback when drag stops (whether dropped or not) const stopDragging = async () => { - console.log("STOP") // Save changes if (gridStyles) { await builderStore.actions.updateStyles(gridStyles, dragInfo.id)