From 8b1eca696a8b6f1115e1fb74d6189d296f9db13c Mon Sep 17 00:00:00 2001 From: Dean Date: Wed, 31 May 2023 15:01:15 +0100 Subject: [PATCH] Fix for deployment refresh in overiew section --- .../portal/overview/[appId]/overview.svelte | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/overview/[appId]/overview.svelte b/packages/builder/src/pages/builder/portal/overview/[appId]/overview.svelte index 4e84b78f67..0932d2d79a 100644 --- a/packages/builder/src/pages/builder/portal/overview/[appId]/overview.svelte +++ b/packages/builder/src/pages/builder/portal/overview/[appId]/overview.svelte @@ -51,6 +51,26 @@ return groups.actions.getGroupAppIds(group).includes(prodAppId) }) + const updateDeploymentString = () => { + return deployments?.length + ? processStringSync( + "Last published {{ duration time 'millisecond' }} ago", + { + time: + new Date().getTime() - + new Date(deployments[0].updatedAt).getTime(), + } + ) + : "" + } + // App is updating in the layout asynchronously + $: if ($store.appId?.length) { + fetchDeployments().then(resp => { + deployments = resp + }) + } + $: deploymentString = updateDeploymentString(deployments) + async function fetchAppEditor(editorId) { appEditor = await users.get(editorId) } @@ -107,19 +127,11 @@
- {#if deployments?.length} - {processStringSync( - "Last published {{ duration time 'millisecond' }} ago", - { - time: - new Date().getTime() - - new Date(deployments[0].updatedAt).getTime(), - } - )} - {#if isPublished} - - Unpublish - {/if} + {#if isPublished} + {deploymentString} + - Unpublish {/if} + {#if !deployments?.length} - {/if}