diff --git a/packages/client/src/components/ClientApp.svelte b/packages/client/src/components/ClientApp.svelte index 2db1a20485..912fc60fcd 100644 --- a/packages/client/src/components/ClientApp.svelte +++ b/packages/client/src/components/ClientApp.svelte @@ -85,7 +85,6 @@ onMount(async () => { await initialise() await authStore.actions.fetchUser() - await roleStore.actions.fetchAccessibleRoles() dataLoaded = true if (get(builderStore).inBuilder) { builderStore.actions.notifyLoaded() diff --git a/packages/client/src/components/app/Layout.svelte b/packages/client/src/components/app/Layout.svelte index 5a0acd25be..e482e6b336 100644 --- a/packages/client/src/components/app/Layout.svelte +++ b/packages/client/src/components/app/Layout.svelte @@ -60,8 +60,7 @@ }) setContext("layout", store) - $: accessibleRoles = $roleStore - $: validLinks = getValidLinks(links) + $: validLinks = getValidLinks(links, $roleStore) $: typeClass = NavigationClasses[navigation] || NavigationClasses.None $: navWidthClass = WidthClasses[navWidth || width] || WidthClasses.Large $: pageWidthClass = WidthClasses[pageWidth || width] || WidthClasses.Large @@ -99,12 +98,12 @@ } } - const getValidLinks = allLinks => { + const getValidLinks = (allLinks, userRoleHierarchy) => { // Strip links missing required info let validLinks = (allLinks || []).filter(link => link.text && link.url) // Filter to only links allowed by the current role return validLinks.filter(link => { - return accessibleRoles?.find(roleId => roleId === link.roleId) + return userRoleHierarchy?.find(roleId => roleId === link.roleId) }) } diff --git a/packages/client/src/components/devtools/DevToolsHeader.svelte b/packages/client/src/components/devtools/DevToolsHeader.svelte index a60cec8ce1..a15e8351a5 100644 --- a/packages/client/src/components/devtools/DevToolsHeader.svelte +++ b/packages/client/src/components/devtools/DevToolsHeader.svelte @@ -1,32 +1,39 @@
@@ -34,7 +41,7 @@