soulsync/webui/src/routes/__root.tsx
Antti Kettunen fec66e4de8
feat(webui): expose shell status in root context
- add a shared shell client and root /status query
- attach shell status to the TanStack root context for React routes
- keep the shell bridge types and test setup aligned with the new status data
2026-05-23 21:23:32 +03:00

25 lines
751 B
TypeScript

import { Outlet, createRootRouteWithContext } from '@tanstack/react-router';
import type { AppRouterContext } from '@/app/router';
import { waitForShellContext } from '@/platform/shell/bridge';
import { shellStatusQueryOptions } from '@/platform/shell/status';
import { IssueDomainHost } from './issues/-ui/issue-domain-host';
export const Route = createRootRouteWithContext<AppRouterContext>()({
beforeLoad: async ({ context }) => {
const [shell, status] = await Promise.all([
waitForShellContext(),
context.queryClient.fetchQuery(shellStatusQueryOptions()).catch(() => undefined),
]);
return { shell: { ...shell, status } };
},
component: () => (
<>
<Outlet />
<IssueDomainHost />
</>
),
});