Fix issue causing client apps to initialise 3 times

This commit is contained in:
Andrew Kingston 2023-10-02 08:19:59 +01:00
parent cddb2d9aff
commit 986069d7d7
3 changed files with 9 additions and 2 deletions

View File

@ -25,7 +25,6 @@
value: roleId,
})
}
devToolsStore.actions.changeRole(SELF_ROLE)
return list
}

View File

@ -2,6 +2,7 @@ import { createLocalStorageStore } from "@budibase/frontend-core"
import { initialise } from "./initialise"
import { authStore } from "./auth"
import { API } from "../api"
import { get } from "svelte/store"
const initialState = {
visible: false,
@ -27,9 +28,15 @@ const createDevToolStore = () => {
}
const changeRole = async role => {
if (role === "self") {
role = null
}
if (role === get(store).role) {
return
}
store.update(state => ({
...state,
role: role === "self" ? null : role,
role,
}))
API.invalidateCache()
await authStore.actions.fetchUser()

View File

@ -3,6 +3,7 @@ import { appStore } from "./app"
import { orgStore } from "./org"
export async function initialise() {
console.log("initialise!")
await routeStore.actions.fetchRoutes()
await appStore.actions.fetchAppDefinition()
await orgStore.actions.init()