Files
HealthLog/src/components/layout/record-scope-hydration-gate.tsx
T
Marc-André Bombeck acd96a80e9 fix(02-12): gate protected routes on record scope
- resolve account capabilities before protected page queries mount\n- leave public routes outside the record loading gate
2026-08-06 05:04:26 +02:00

20 lines
657 B
TypeScript

import { Loader2 } from "lucide-react";
/**
* Holds protected route trees until `/api/auth/me` has resolved the active
* record and its capabilities. Mounting a child before this point can issue a
* request for the actor's record before the shared-record scope is known.
*/
export function RecordScopeHydrationGate({ label }: { label: string }) {
return (
<div
data-slot="record-scope-hydration-gate"
className="flex h-dvh items-center justify-center"
role="status"
>
<Loader2 className="text-primary h-6 w-6 animate-spin motion-reduce:animate-none" />
<span className="sr-only">{label}</span>
</div>
);
}