FIX - HUB PERMISSIONS: refresh admin downgrade live

This commit is contained in:
DCCONSTRUCTIONS 2026-05-14 14:41:10 +03:00
parent 712e9224c0
commit dc5f36e5f4
1 changed files with 8 additions and 11 deletions

View File

@ -375,6 +375,13 @@ export function LauncherApp() {
void refreshTaskManagerWorkspaces(); void refreshTaskManagerWorkspaces();
}, [adminOpen, canOpenAdminApi]); }, [adminOpen, canOpenAdminApi]);
useEffect(() => {
if (runtimeMe.permissions.canOpenAdmin) return;
setAdminOpen(false);
setAdminMode("admin");
}, [runtimeMe.permissions.canOpenAdmin]);
const refreshRuntimeState = useCallback(async () => { const refreshRuntimeState = useCallback(async () => {
try { try {
const nextSession = await fetchAuthSession(); const nextSession = await fetchAuthSession();
@ -386,18 +393,8 @@ export function LauncherApp() {
return; return;
} }
const currentData = runtimeDataRef.current;
const nextContext = resolveAuthenticatedContext(
currentData,
nextSession,
runtimeProfileIdRef.current,
runtimeClientIdRef.current
);
const nextMe = buildMe(currentData, nextContext.profileId, nextContext.clientId);
const [persistedData, apps] = await Promise.all([ const [persistedData, apps] = await Promise.all([
nextSession.isSuperAdmin || nextMe.permissions.canOpenAdmin loadPersistedLauncherData(),
? fetchControlPlaneSnapshot().then((snapshot) => snapshot.data)
: loadPersistedLauncherData(),
fetchAvailableApps(), fetchAvailableApps(),
]); ]);