From 9c4e0b41073f457c78b69959ba98b398f6100e6d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 16 Sep 2022 15:20:02 +0200 Subject: [PATCH] fix: get building status --- .../routes/applications/[id]/previews/index.svelte | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/ui/src/routes/applications/[id]/previews/index.svelte b/apps/ui/src/routes/applications/[id]/previews/index.svelte index 483904e51..2c5010283 100644 --- a/apps/ui/src/routes/applications/[id]/previews/index.svelte +++ b/apps/ui/src/routes/applications/[id]/previews/index.svelte @@ -24,14 +24,14 @@ import { t } from '$lib/translations'; import { goto } from '$app/navigation'; import { asyncSleep, errorNotification, getDomain, getRndInteger } from '$lib/common'; - import { onMount } from 'svelte'; + import { onDestroy, onMount } from 'svelte'; import { addToast } from '$lib/store'; import SimpleExplainer from '$lib/components/SimpleExplainer.svelte'; import Tooltip from '$lib/components/Tooltip.svelte'; import DeleteIcon from '$lib/components/DeleteIcon.svelte'; const { id } = $page.params; - + let loadBuildingStatusInterval: any = null; let PRMRSecrets: any; let applicationSecrets: any; let loading = { @@ -137,7 +137,17 @@ loading.restart = false; } } + onDestroy(() => { + clearInterval(loadBuildingStatusInterval); + }); onMount(async () => { + loadBuildingStatusInterval = setInterval(() => { + application.previewApplication.forEach((preview: any) => { + if (status[id] === 'building') { + getStatus(preview); + } + }); + }, 3000); try { loading.init = true; loading.restart = true;