performance optimization regarding tenant id fetch

This commit is contained in:
Oliver Kieselbach
2026-04-07 10:19:34 +02:00
parent 82ba96ad68
commit 5b76ca2aef
2 changed files with 10 additions and 1 deletions
@@ -145,6 +145,15 @@ export default function SessionDetailPage() {
if (hasInitialFetch.current) return;
hasInitialFetch.current = true;
// Performance: eager-set sessionTenantId if we already know it from TenantContext.
// This lets the second useEffect kick off fetchEvents/analysis/vulns/config in parallel
// with fetchSessionDetails instead of waiting for its roundtrip — eliminates a waterfall.
// Global Admins in all-tenant view fall through with null and keep the old behavior.
const knownTenantId = resolveEffectiveTenantId();
if (knownTenantId && isGuid(knownTenantId)) {
setSessionTenantId(knownTenantId);
}
fetchSessionDetails();
// fetchEvents will be called after sessionTenantId is set
}, [sessionId, tenantId, globalAdminMode, user]);
File diff suppressed because one or more lines are too long