From 2bdf85521705d2224823003b84312abd4d5b9911 Mon Sep 17 00:00:00 2001 From: Dean Date: Tue, 20 Jun 2023 17:25:20 +0100 Subject: [PATCH] Removed app publish state tracking --- .../src/components/deploy/AppActions.svelte | 113 +----------------- .../app/[application]/settings/embed.svelte | 2 +- 2 files changed, 5 insertions(+), 110 deletions(-) diff --git a/packages/builder/src/components/deploy/AppActions.svelte b/packages/builder/src/components/deploy/AppActions.svelte index 1de5a4a798..0c478b9992 100644 --- a/packages/builder/src/components/deploy/AppActions.svelte +++ b/packages/builder/src/components/deploy/AppActions.svelte @@ -22,15 +22,10 @@ import { API } from "api" import { onMount } from "svelte" import { apps } from "stores/portal" - import { - store, - screenHistoryStore, - automationHistoryStore, - } from "builderStore" + import { store } from "builderStore" import TourWrap from "components/portal/onboarding/TourWrap.svelte" import { TOUR_STEP_KEYS } from "components/portal/onboarding/tours.js" import { goto } from "@roxi/routify" - import { isEqual, cloneDeep } from "lodash" export let application export let loaded @@ -62,80 +57,7 @@ $store.version && $store.upgradableVersion !== $store.version - let cachedVersion = $store.version + "" - let versionAltered = false - let screensAltered = false - let automationsAltered = false - - let publishRecord = { - screenHistory: null, - automationHistory: null, - } - - //Meta Changes - let appMeta = {} - let appMetaUpdated = false - let appMetaInitialised = false - - store.subscribe(state => { - let { name, url: appUrl, navigation, theme, customTheme, icon } = state - const update = { - name, - url: appUrl, - navigation: { ...cloneDeep(navigation) }, - theme, - customTheme, - icon, - } - - if (!isEqual(update, appMeta)) { - if (!appMetaInitialised) { - appMetaInitialised = true - } else { - appMetaUpdated = true - } - appMeta = { - ...(appMeta || {}), - ...update, - } - } - }) - - const monitorHistoryStore = (historyStore, publishedHistoryId, cb) => { - if (!historyStore.history.length || historyStore.loading) { - return - } - if (!historyStore.canUndo) { - cb(publishedHistoryId != -1) - return - } - const historyEntry = historyStore.history[historyStore.position - 1] - - if (historyEntry) { - cb(publishedHistoryId != historyEntry.id) - } - } - - $: monitorHistoryStore( - $screenHistoryStore, - publishRecord.screenHistory, - updated => { - screensAltered = updated - } - ) - - $: monitorHistoryStore( - $automationHistoryStore, - publishRecord.automationHistory, - updated => { - automationsAltered = updated - } - ) - - $: versionAltered = cachedVersion != $store.version - $: altered = - screensAltered || appMetaUpdated || automationsAltered || versionAltered - $: canPublish = (!isPublished || altered) && !publishing && loaded + $: canPublish = !publishing && loaded const initialiseApp = async () => { const applicationPkg = await API.fetchAppPackage($store.devId) @@ -191,27 +113,6 @@ } } - const resetAppHistory = (historyStore, historyKey) => { - if (historyStore.history.length) { - const historyEntryPos = historyStore.position - const historyEntry = historyStore.history[historyEntryPos - 1] - - publishRecord = { - ...publishRecord, - [historyKey]: historyEntry?.id || -1, - } - } - } - - const resetStateTracking = () => { - resetAppHistory($automationHistoryStore, "automationHistory") - resetAppHistory($screenHistoryStore, "screenHistory") - automationsAltered = false - screensAltered = false - appMetaUpdated = false - cachedVersion = $store.version + "" - } - async function publishApp() { try { publishing = true @@ -224,7 +125,6 @@ }) await completePublish() - resetStateTracking() } catch (error) { console.error(error) analytics.captureException(error) @@ -255,7 +155,6 @@ type: "success", icon: "GlobeStrike", }) - publishRecord = {} } catch (err) { notifications.error("Error unpublishing app") } @@ -452,12 +351,8 @@ /> - - + + {:else}
diff --git a/packages/builder/src/pages/builder/app/[application]/settings/embed.svelte b/packages/builder/src/pages/builder/app/[application]/settings/embed.svelte index 10d03d78b4..827c298316 100644 --- a/packages/builder/src/pages/builder/app/[application]/settings/embed.svelte +++ b/packages/builder/src/pages/builder/app/[application]/settings/embed.svelte @@ -18,7 +18,7 @@ $: appUrl = `${window.origin}/embed${app?.url}` $: appDeployed = app?.status === AppStatus.DEPLOYED - $: embed = `` + $: embed = ``