Fix issue causing client apps to initialise 3 times
This commit is contained in:
parent
cddb2d9aff
commit
986069d7d7
|
@ -25,7 +25,6 @@
|
|||
value: roleId,
|
||||
})
|
||||
}
|
||||
devToolsStore.actions.changeRole(SELF_ROLE)
|
||||
return list
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue