- 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
25 lines
751 B
TypeScript
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 />
|
|
</>
|
|
),
|
|
});
|