Fix real root issue

This commit is contained in:
Andrew Kingston 2023-04-25 08:44:57 +01:00
parent 22d81fd858
commit 123c47c4d1
2 changed files with 8 additions and 7 deletions

View File

@ -5,12 +5,12 @@ import {
} from "@budibase/frontend-core"
import { store } from "./builderStore"
import { get } from "svelte/store"
import { auth, overview } from "./stores/portal"
import { auth } from "./stores/portal"
export const API = createAPIClient({
attachHeaders: headers => {
// Attach app ID header from store
let appId = get(store).appId || get(overview).selectedAppId
let appId = get(store).appId
if (appId) {
headers["x-budibase-app-id"] = appId
}

View File

@ -47,6 +47,7 @@
let deletionModal
let exportPublishedVersion = false
let deletionConfirmationAppName
let loaded = false
$: app = $overview.selectedApp
$: appId = $overview.selectedAppId
@ -56,10 +57,12 @@
$: lockedByYou = $auth.user.email === app?.lockedBy?.email
const initialiseApp = async appId => {
loaded = false
try {
const pkg = await API.fetchAppPackage(appId)
await store.actions.initialise(pkg)
await API.syncApp(appId)
loaded = true
} catch (error) {
notifications.error("Error initialising app overview")
$goto("../../")
@ -111,10 +114,6 @@
onDestroy(() => {
stopSyncing()
store.actions.reset()
overview.update(state => ({
...state,
selectedAppId: null,
}))
})
</script>
@ -232,7 +231,9 @@
active={$isActive("./version")}
/>
</SideNav>
<slot />
{#if loaded}
<slot />
{/if}
</Content>
</Layout>
</Page>