mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-24 20:53:06 +00:00
performance optimization regarding tenant id fetch
This commit is contained in:
@@ -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
Reference in New Issue
Block a user