1
0
Fork 0
mirror of synced 2024-07-28 17:46:09 +12:00

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, value: roleId,
}) })
} }
devToolsStore.actions.changeRole(SELF_ROLE)
return list return list
} }

View file

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

View file

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