fix re-auth for session detail and diag page

This commit is contained in:
Oliver Kieselbach
2026-06-10 00:33:29 +02:00
parent 59fa22a28e
commit dca4da50ed
2 changed files with 20 additions and 6 deletions
@@ -246,11 +246,18 @@ export default function DiagnosisPage() {
);
const warningEvents = events.filter((e) => e.severity === "Warning");
// Keep this early-return wrapped in <ProtectedRoute>: on a fresh direct
// navigation (new tab, bookmark, shared link) the auth cache is empty, so the
// tenant-gated fetch never runs and `loading` stays true forever. Without the
// gate here we'd hang on "Loading diagnosis..." and never trigger the MSAL
// login redirect. See the matching note in app/sessions/[sessionId]/page.tsx.
if (loading) {
return (
<div className="min-h-screen bg-gray-50 flex items-center justify-center">
<div className="text-gray-600">Loading diagnosis...</div>
</div>
<ProtectedRoute>
<div className="min-h-screen bg-gray-50 flex items-center justify-center">
<div className="text-gray-600">Loading diagnosis...</div>
</div>
</ProtectedRoute>
);
}
@@ -352,11 +352,18 @@ export default function SessionDetailPage() {
// Only show full-page loading spinner on the very first load (no data yet).
// Subsequent refreshes (SignalR, 30s poll) keep the existing UI visible.
// NOTE: this early-return MUST stay wrapped in <ProtectedRoute>. On a fresh
// direct navigation (new tab, bookmark, shared link) the auth cache is empty,
// so `loading` never flips and we'd render this branch forever — bypassing the
// auth gate and hanging on "Loading session details..." without ever triggering
// the MSAL login redirect. Wrapping here lets ProtectedRoute drive re-auth.
if (loading && !session && events.length === 0) {
return (
<div className="min-h-screen bg-gray-50 flex items-center justify-center">
<div className="text-gray-600">Loading session details...</div>
</div>
<ProtectedRoute>
<div className="min-h-screen bg-gray-50 flex items-center justify-center">
<div className="text-gray-600">Loading session details...</div>
</div>
</ProtectedRoute>
);
}