diff --git a/packages/client/src/components/app/Layout.svelte b/packages/client/src/components/app/Layout.svelte index e482e6b336..bdab0dd9ab 100644 --- a/packages/client/src/components/app/Layout.svelte +++ b/packages/client/src/components/app/Layout.svelte @@ -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) }) } diff --git a/packages/client/src/components/devtools/DevToolsHeader.svelte b/packages/client/src/components/devtools/DevToolsHeader.svelte index a15e8351a5..55b705e717 100644 --- a/packages/client/src/components/devtools/DevToolsHeader.svelte +++ b/packages/client/src/components/devtools/DevToolsHeader.svelte @@ -25,7 +25,6 @@ value: roleId, }) } - devToolsStore.actions.changeRole(SELF_ROLE) return list } diff --git a/packages/client/src/stores/devTools.js b/packages/client/src/stores/devTools.js index 32f3c8e617..db9b9e10b4 100644 --- a/packages/client/src/stores/devTools.js +++ b/packages/client/src/stores/devTools.js @@ -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()