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