fix: canAccess + isModuleVisible fallback while permissions loading (contacts + settings link)

This commit is contained in:
Agent Zero
2026-07-30 01:53:30 +02:00
parent c5f0ef9d4d
commit 25e70cf749
3 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -50,8 +50,8 @@ export function Sidebar() {
// Use hasPermission directly — permissions are loaded via useUserPermissions hook
const canAccess = (perm?: string): boolean => {
if (!perm) return true;
// While permissions are loading, show everything (backend 403 catches errors)
if (!user || (user.permissions?.length === 0 && user.is_system_admin === undefined)) return true;
// While permissions are loading (undefined), show everything; backend 403 catches errors
if (!user?.permissions && user?.is_system_admin === undefined) return true;
return hasPermission(perm);
};