({
children,
params,
}: {
children: React.ReactNode
params: Promise<{ workspaceId: string }>
})
| 16 | import { getOrgWhitelabelSettings } from '@/ee/whitelabeling/org-branding' |
| 17 | |
| 18 | export default async function WorkspaceLayout({ |
| 19 | children, |
| 20 | params, |
| 21 | }: { |
| 22 | children: React.ReactNode |
| 23 | params: Promise<{ workspaceId: string }> |
| 24 | }) { |
| 25 | const session = await getSession() |
| 26 | if (!session?.user) { |
| 27 | redirect('/login') |
| 28 | } |
| 29 | |
| 30 | const { workspaceId } = await params |
| 31 | const initialSidebarCollapsed = (await cookies()).get('sidebar_collapsed')?.value === '1' |
| 32 | const queryClient = getQueryClient() |
| 33 | const sidebarPrefetch = prefetchWorkspaceSidebar(queryClient, workspaceId, session.user.id) |
| 34 | |
| 35 | // The organization plugin is conditionally spread so TS can't infer activeOrganizationId on the base session type. |
| 36 | const orgId = (session.session as { activeOrganizationId?: string } | null)?.activeOrganizationId |
| 37 | const initialOrgSettings = orgId ? await getOrgWhitelabelSettings(orgId) : null |
| 38 | |
| 39 | await sidebarPrefetch |
| 40 | |
| 41 | return ( |
| 42 | <BrandingProvider initialOrgSettings={initialOrgSettings}> |
| 43 | <ToastProvider> |
| 44 | <SettingsLoader /> |
| 45 | <ProviderModelsLoader /> |
| 46 | <GlobalCommandsProvider> |
| 47 | <div className='flex h-screen w-full flex-col overflow-hidden bg-[var(--surface-1)]'> |
| 48 | <ImpersonationBanner /> |
| 49 | <WorkspacePermissionsProvider> |
| 50 | <WorkspaceScopeSync /> |
| 51 | <HydrationBoundary state={dehydrate(queryClient)}> |
| 52 | <WorkspaceChrome initialSidebarCollapsed={initialSidebarCollapsed}> |
| 53 | {children} |
| 54 | </WorkspaceChrome> |
| 55 | </HydrationBoundary> |
| 56 | </WorkspacePermissionsProvider> |
| 57 | </div> |
| 58 | </GlobalCommandsProvider> |
| 59 | </ToastProvider> |
| 60 | </BrandingProvider> |
| 61 | ) |
| 62 | } |
nothing calls this directly
no test coverage detected