1
0
Fork 0
mirror of synced 2024-07-06 15:00:49 +12:00

Merge pull request #11939 from Budibase/fix/client-initialisation

Fix client initialisation and fix navigation links being hidden
This commit is contained in:
Andrew Kingston 2023-10-02 08:50:19 +01:00 committed by GitHub
commit b2ea82b8ba
3 changed files with 11 additions and 3 deletions

View file

@ -3,6 +3,7 @@
import { writable } from "svelte/store"
import { Heading, Icon, clickOutside } from "@budibase/bbui"
import { FieldTypes } from "constants"
import { Constants } from "@budibase/frontend-core"
import active from "svelte-spa-router/active"
const sdk = getContext("sdk")
@ -103,7 +104,8 @@
let validLinks = (allLinks || []).filter(link => link.text && link.url)
// Filter to only links allowed by the current role
return validLinks.filter(link => {
return userRoleHierarchy?.find(roleId => roleId === link.roleId)
const role = link.roleId || Constants.Roles.BASIC
return userRoleHierarchy?.find(roleId => roleId === role)
})
}

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()