1
0
Fork 0
mirror of synced 2024-10-02 18:16:29 +13:00

Merge pull request #10406 from Budibase/fix/budi-6920

Fix automation history first load in multi-tenant environments
This commit is contained in:
Michael Drury 2023-04-25 11:43:08 +01:00 committed by GitHub
commit e37b377036
2 changed files with 11 additions and 3 deletions

View file

@ -10,7 +10,10 @@ import { auth } from "./stores/portal"
export const API = createAPIClient({
attachHeaders: headers => {
// Attach app ID header from store
headers["x-budibase-app-id"] = get(store).appId
let appId = get(store).appId
if (appId) {
headers["x-budibase-app-id"] = appId
}
// Add csrf token if authenticated
const user = get(auth).user

View file

@ -33,7 +33,7 @@
import * as routify from "@roxi/routify"
import { onDestroy } from "svelte"
// Keep URL and state in sync for selected screen ID
// Keep URL and state in sync for selected app ID
const stopSyncing = syncURLToState({
urlParam: "appId",
stateKey: "selectedAppId",
@ -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("../../")
@ -228,7 +231,9 @@
active={$isActive("./version")}
/>
</SideNav>
<slot />
{#if loaded}
<slot />
{/if}
</Content>
</Layout>
</Page>